]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Remove support for the VMCI domain on ESX
authorVMware, Inc <>
Mon, 26 Sep 2011 18:52:24 +0000 (11:52 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Mon, 26 Sep 2011 18:52:24 +0000 (11:52 -0700)
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/modules/linux/vmci/common/vmciCommonInt.h
open-vm-tools/modules/linux/vmci/common/vmciContext.c
open-vm-tools/modules/linux/vmci/common/vmciContext.h
open-vm-tools/modules/linux/vmci/common/vmciDatagram.c
open-vm-tools/modules/linux/vmci/common/vmciQueuePair.c
open-vm-tools/modules/linux/vmci/linux/vmci_version.h

index 2547569efa3c822a6cff9d6f209cbe1643e1f12a..956eaba92d0f87685fdb508221f2ba1044772446 100644 (file)
@@ -85,7 +85,6 @@ struct VMCIContext {
    VMCIHostUser       user;
    Bool               validUser;
 #ifdef VMKERNEL
-   char               domainName[VMCI_DOMAIN_NAME_MAXLEN];
    Bool               isQuiesced;       /* Whether current VM is quiesced */
    VMCIId             migrateCid;       /* The migrate cid if it is migrating */
 #endif
@@ -105,8 +104,7 @@ struct VMCIContext {
  *
  *     Utilility function that checks whether two entities are allowed
  *     to interact. If one of them is restricted, the other one must
- *     be trusted. On ESX, the vmci domain must match for unrestricted
- *     domains.
+ *     be trusted.
  *
  *  Result:
  *     TRUE if the two entities are not allowed to interact. FALSE otherwise.
@@ -119,46 +117,12 @@ struct VMCIContext {
 
 static INLINE Bool
 VMCIDenyInteraction(VMCIPrivilegeFlags partOne,  // IN
-                    VMCIPrivilegeFlags partTwo,  // IN
-                    const char *srcDomain,       // IN:  Unused on hosted
-                    const char *dstDomain)       // IN:  Unused on hosted
+                    VMCIPrivilegeFlags partTwo)  // IN
 {
-#ifndef VMKERNEL
    return (((partOne & VMCI_PRIVILEGE_FLAG_RESTRICTED) &&
             !(partTwo & VMCI_PRIVILEGE_FLAG_TRUSTED)) ||
            ((partTwo & VMCI_PRIVILEGE_FLAG_RESTRICTED) &&
             !(partOne & VMCI_PRIVILEGE_FLAG_TRUSTED)));
-#else
-   /*
-    * If source or destination is trusted (hypervisor), we allow the
-    * communication.
-    */
-   if ((partOne & VMCI_PRIVILEGE_FLAG_TRUSTED) ||
-       (partTwo & VMCI_PRIVILEGE_FLAG_TRUSTED)) {
-      return FALSE;
-   }
-   /*
-    * If source or destination is restricted, we deny the communication.
-    */
-   if ((partOne & VMCI_PRIVILEGE_FLAG_RESTRICTED) ||
-       (partTwo & VMCI_PRIVILEGE_FLAG_RESTRICTED)) {
-      return TRUE;
-   }
-   /*
-    * We are here, means that neither of source or destination are trusted, and
-    * both are unrestricted.
-    */
-   ASSERT(!(partOne & VMCI_PRIVILEGE_FLAG_TRUSTED) &&
-          !(partTwo & VMCI_PRIVILEGE_FLAG_TRUSTED));
-   ASSERT(!(partOne & VMCI_PRIVILEGE_FLAG_RESTRICTED) &&
-          !(partTwo & VMCI_PRIVILEGE_FLAG_RESTRICTED));
-   /*
-    * We now compare the source and destination domain names, and allow
-    * communication iff they match.
-    */
-   return strcmp(srcDomain, dstDomain) ? TRUE : /* Deny. */
-                                         FALSE; /* Allow. */
-#endif
 }
 
 #endif /* _VMCI_COMMONINT_H_ */
index 0113e373297e8c9951a61f0d6910db6d577869f2..ae14d1ae35946def0fa68f5a37ac5c6ba9c66b57 100644 (file)
@@ -45,8 +45,7 @@
 static void VMCIContextFreeContext(VMCIContext *context);
 static Bool VMCIContextExists(VMCIId cid);
 static int VMCIContextFireNotification(VMCIId contextID,
-                                       VMCIPrivilegeFlags privFlags,
-                                       const char *domain);
+                                       VMCIPrivilegeFlags privFlags);
 
 /*
  * List of current VMCI contexts.
@@ -176,36 +175,6 @@ VMCIContext_CheckAndSignalNotify(VMCIContext *context) // IN:
 #endif
 
 
-/*
- *----------------------------------------------------------------------
- *
- * VMCIContextGetDomainName --
- *
- *      Internal function for retrieving a context domain name, if
- *      supported by the platform. The returned pointer can only be
- *      assumed valid while a reference count is held on the given
- *      context.
- *
- * Results:
- *      Pointer to name if appropriate. NULL otherwise.
- *
- * Side effects:
- *      None.
- *
- *----------------------------------------------------------------------
- */
-
-static INLINE char *
-VMCIContextGetDomainName(VMCIContext *context) // IN
-{
-#ifdef VMKERNEL
-   return context->domainName;
-#else
-   return NULL;
-#endif
-}
-
-
 /*
  *----------------------------------------------------------------------
  *
@@ -386,10 +355,6 @@ VMCIContext_InitContext(VMCIId cid,                   // IN
    VMCI_ReleaseLock(&contextList.lock, flags);
 
 #ifdef VMKERNEL
-   /*
-    * Set default domain name.
-    */
-   VMCIContext_SetDomainName(context, "");
    VMCIContext_SetFSRState(context, FALSE, VMCI_INVALID_ID, eventHnd, FALSE);
 #endif
 
@@ -482,8 +447,7 @@ VMCIContextFreeContext(VMCIContext *context)  // IN
    VMCIHandle tempHandle;
 
    /* Fire event to all contexts interested in knowing this context is dying. */
-   VMCIContextFireNotification(context->cid, context->privFlags,
-                               VMCIContextGetDomainName(context));
+   VMCIContextFireNotification(context->cid, context->privFlags);
 
    /*
     * Cleanup all queue pair resources attached to context.  If the VM dies
@@ -1407,8 +1371,7 @@ VMCIContext_RemoveNotification(VMCIId contextID,  // IN:
 
 static int
 VMCIContextFireNotification(VMCIId contextID,             // IN
-                            VMCIPrivilegeFlags privFlags, // IN
-                            const char *domain)           // IN
+                            VMCIPrivilegeFlags privFlags) // IN
 {
    uint32 i, arraySize;
    VMCIListItem *next;
@@ -1443,8 +1406,7 @@ VMCIContextFireNotification(VMCIId contextID,             // IN
        */
 
       if (VMCIHandleArray_HasEntry(subCtx->notifierArray, contextHandle) &&
-          !VMCIDenyInteraction(privFlags, subCtx->privFlags, domain,
-                               VMCIContextGetDomainName(subCtx))) {
+          !VMCIDenyInteraction(privFlags, subCtx->privFlags)) {
          VMCIHandleArray_AppendEntry(&subscriberArray,
                                      VMCI_MAKE_HANDLE(subCtx->cid,
                                                       VMCI_EVENT_HANDLER));
@@ -1975,18 +1937,7 @@ VMCIContext_NotifyDoorbell(VMCIId srcCID,                   // IN
 
    if (srcCID != handle.context) {
       VMCIPrivilegeFlags dstPrivFlags;
-#if !defined(VMKERNEL)
-      char *srcDomain = NULL;
-#else
-      char srcDomain[VMCI_DOMAIN_NAME_MAXLEN];
 
-      result = VMCIContext_GetDomainName(srcCID, srcDomain, sizeof srcDomain);
-      if (result < VMCI_SUCCESS) {
-         VMCI_WARNING((LGPFX"Failed to get domain name for source context "
-                       "(ID=0x%x).\n", srcCID));
-         goto out;
-      }
-#endif
       result = VMCIDoorbellGetPrivFlags(handle, &dstPrivFlags);
       if (result < VMCI_SUCCESS) {
          VMCI_WARNING((LGPFX"Failed to get privilege flags for destination "
@@ -2000,8 +1951,7 @@ VMCIContext_NotifyDoorbell(VMCIId srcCID,                   // IN
          srcPrivFlags = VMCIContext_GetPrivFlags(srcCID);
       }
 
-      if (VMCIDenyInteraction(srcPrivFlags, dstPrivFlags, srcDomain,
-                              VMCIContextGetDomainName(dstContext))) {
+      if (VMCIDenyInteraction(srcPrivFlags, dstPrivFlags)) {
          result = VMCI_ERROR_NO_ACCESS;
          goto out;
       }
@@ -2127,92 +2077,6 @@ VMCIContext_SignalPendingDatagrams(VMCIId contextID)
    VMCIContext_Release(context);
 }
 
-
-/*
- *----------------------------------------------------------------------
- *
- * VMCIContext_SetDomainName --
- *
- *      Sets the domain name of the given context.
- *
- * Results:
- *      VMCI_SUCCESS on success, error code otherwise.
- *
- * Side effects:
- *      None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-VMCIContext_SetDomainName(VMCIContext *context,   // IN;
-                          const char *domainName) // IN:
-{
-   size_t domainNameLen;
-
-   if (!context || !domainName) {
-      return VMCI_ERROR_INVALID_ARGS;
-   }
-
-   domainNameLen = strlen(domainName);
-   if (domainNameLen >= sizeof context->domainName) {
-      return VMCI_ERROR_NO_MEM;
-   }
-
-   memcpy(context->domainName, domainName, domainNameLen + 1);
-
-   return VMCI_SUCCESS;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * VMCIContext_GetDomainName --
- *
- *      Returns the domain name of the given context.
- *
- * Results:
- *      VMCI_SUCCESS on success, error code otherwise.
- *
- * Side effects:
- *      None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-VMCIContext_GetDomainName(VMCIId contextID,         // IN:
-                          char *domainName,         // OUT:
-                          size_t domainNameBufSize) // IN:
-{
-   VMCIContext *context;
-   int rv = VMCI_SUCCESS;
-   size_t domainNameLen;
-
-   if (contextID == VMCI_INVALID_ID || !domainName || !domainNameBufSize) {
-      return VMCI_ERROR_INVALID_ARGS;
-   }
-
-   context = VMCIContext_Get(contextID);
-   if (!context) {
-      return VMCI_ERROR_NOT_FOUND;
-   }
-
-   domainNameLen = strlen(context->domainName);
-   if (domainNameLen >= domainNameBufSize) {
-      rv = VMCI_ERROR_NO_MEM;
-      goto out;
-   }
-
-   memcpy(domainName, context->domainName, domainNameLen + 1);
-
-out:
-   VMCIContext_Release(context);
-   return rv;
-}
-
-
 #endif // defined(VMKERNEL)
 
 
index 12a490b173fe2522614c1b2ad4fe0098a50a20ab..754cc556b6caf737751bc50a62f9929f891017d0 100644 (file)
@@ -47,9 +47,6 @@ int VMCIContext_InitContext(VMCIId cid, VMCIPrivilegeFlags flags,
                             uintptr_t eventHnd, int version,
                             VMCIHostUser *user, VMCIContext **context);
 #ifdef VMKERNEL
-int VMCIContext_SetDomainName(VMCIContext *context, const char *domainName);
-int VMCIContext_GetDomainName(VMCIId contextID, char *domainName,
-                              size_t domainNameBufSize);
 void VMCIContext_SetFSRState(VMCIContext *context,
                              Bool isQuiesced,
                              VMCIId migrateCid,
index 2a0e837e90494ddc55d07f1011c1eef50a5bbf88..fcd8cdfaffd449c81302c79978a2c7558ed2d329 100644 (file)
@@ -545,8 +545,6 @@ VMCIDatagramDispatchAsHost(VMCIId contextID,  // IN:
    int retval;
    size_t dgSize;
    VMCIPrivilegeFlags srcPrivFlags;
-   char srcDomain[VMCI_DOMAIN_NAME_MAXLEN]; /* Not used on hosted. */
-   char dstDomain[VMCI_DOMAIN_NAME_MAXLEN]; /* Not used on hosted. */
 
    ASSERT(dg);
    ASSERT(VMCI_HostPersonalityActive());
@@ -587,24 +585,6 @@ VMCIDatagramDispatchAsHost(VMCIId contextID,  // IN:
       return retval;
    }
 
-#ifdef VMKERNEL
-   /*
-    * In the vmkernel, all communicating contexts except the
-    * hypervisor context must belong to the same domain. If the
-    * hypervisor is the source, the domain doesn't matter.
-    */
-
-   if (contextID != VMCI_HYPERVISOR_CONTEXT_ID) {
-      retval = VMCIContext_GetDomainName(contextID, srcDomain,
-                                         sizeof srcDomain);
-      if (retval < VMCI_SUCCESS) {
-         VMCI_WARNING((LGPFX"Failed to get domain name for context (ID=0x%x).\n",
-                       contextID));
-         return retval;
-      }
-   }
-#endif
-
    /* Determine if we should route to host or guest destination. */
    if (dg->dst.context == VMCI_HOST_CONTEXT_ID) {
       /* Route to host datagram entry. */
@@ -624,18 +604,7 @@ VMCIDatagramDispatchAsHost(VMCIId contextID,  // IN:
          return VMCI_ERROR_INVALID_RESOURCE;
       }
       dstEntry = RESOURCE_CONTAINER(resource, DatagramEntry, resource);
-#ifdef VMKERNEL
-      retval = VMCIContext_GetDomainName(VMCI_HOST_CONTEXT_ID, dstDomain,
-                                         sizeof dstDomain);
-      if (retval < VMCI_SUCCESS) {
-         VMCI_WARNING((LGPFX"Failed to get domain name for context (ID=0x%x).\n",
-                       VMCI_HOST_CONTEXT_ID));
-         VMCIResource_Release(resource);
-         return retval;
-      }
-#endif
-      if (VMCIDenyInteraction(srcPrivFlags, dstEntry->privFlags, srcDomain,
-                              dstDomain)) {
+      if (VMCIDenyInteraction(srcPrivFlags, dstEntry->privFlags)) {
          VMCIResource_Release(resource);
          return VMCI_ERROR_NO_ACCESS;
       }
@@ -692,19 +661,9 @@ VMCIDatagramDispatchAsHost(VMCIId contextID,  // IN:
       /* Route to destination VM context. */
       VMCIDatagram *newDG;
 
-#ifdef VMKERNEL
-      retval = VMCIContext_GetDomainName(dg->dst.context, dstDomain,
-                                         sizeof dstDomain);
-      if (retval < VMCI_SUCCESS) {
-         VMCI_DEBUG_LOG(4, (LGPFX"Failed to get domain name for context "
-                            "(ID=0x%x).\n", dg->dst.context));
-         return retval;
-      }
-#endif
       if (contextID != dg->dst.context &&
          VMCIDenyInteraction(srcPrivFlags,
-                             VMCIContext_GetPrivFlags(dg->dst.context),
-                             srcDomain, dstDomain)) {
+                             VMCIContext_GetPrivFlags(dg->dst.context))) {
          return VMCI_ERROR_NO_ACCESS;
       }
 
index 80f9760d108954bb8fec7e199d22ea25eb2da479..9e7f8ebbb82e2902803703c85dca00d5855b39b5 100644 (file)
@@ -583,52 +583,6 @@ QueuePairList_GetHead(QueuePairList *qpList)
 }
 
 
-/*
- *-----------------------------------------------------------------------------
- *
- * QueuePairDenyConnection --
- *
- *      On ESX we check if the domain names of the two contexts match.
- *      Otherwise we deny the connection.  We always allow the connection on
- *      hosted.
- *
- * Results:
- *      Boolean result.
- *
- * Side effects:
- *      None.
- *
- *-----------------------------------------------------------------------------
- */
-
-static INLINE Bool
-QueuePairDenyConnection(VMCIId contextId, // IN:  Unused on hosted
-                        VMCIId peerId)    // IN:  Unused on hosted
-{
-#ifndef VMKERNEL
-   return FALSE; /* Allow on hosted. */
-#else
-   char contextDomain[VMCI_DOMAIN_NAME_MAXLEN];
-   char peerDomain[VMCI_DOMAIN_NAME_MAXLEN];
-
-   ASSERT(contextId != VMCI_INVALID_ID);
-   if (peerId == VMCI_INVALID_ID) {
-      return FALSE; /* Allow. */
-   }
-   if (VMCIContext_GetDomainName(contextId, contextDomain,
-                                 sizeof contextDomain) != VMCI_SUCCESS) {
-      return TRUE; /* Deny. */
-   }
-   if (VMCIContext_GetDomainName(peerId, peerDomain, sizeof peerDomain) !=
-       VMCI_SUCCESS) {
-      return TRUE; /* Deny. */
-   }
-   return strcmp(contextDomain, peerDomain) ? TRUE : /* Deny. */
-                                              FALSE; /* Allow. */
-#endif
-}
-
-
 /*
  *-----------------------------------------------------------------------------
  *
@@ -1052,16 +1006,7 @@ VMCIQPBrokerCreate(VMCIHandle handle,             // IN
     * must allow the context in handle's context ID as the "peer".
     */
 
-   if ((handle.context != contextId && handle.context != peer) ||
-       QueuePairDenyConnection(contextId, peer)) {
-      return VMCI_ERROR_NO_ACCESS;
-   }
-
-   /*
-    * Check if we should allow this QueuePair connection.
-    */
-
-   if (QueuePairDenyConnection(contextId, peer)) {
+   if (handle.context != contextId && handle.context != peer) {
       return VMCI_ERROR_NO_ACCESS;
    }
 
@@ -1266,14 +1211,6 @@ VMCIQPBrokerAttach(QPBrokerEntry *entry,          // IN
       return VMCI_ERROR_NO_ACCESS;
    }
 
-   /*
-    * Check if we should allow this QueuePair connection.
-    */
-
-   if (QueuePairDenyConnection(contextId, entry->createId)) {
-      return VMCI_ERROR_NO_ACCESS;
-   }
-
    if (entry->createId == VMCI_HOST_CONTEXT_ID) {
       /*
        * Do not attach if the caller doesn't support Host Queue Pairs
index af138355ba1dd7437d6de6e2aad018ec11eaf3e8..bbd902b29789a5b1ee205764b82d1badcbf4c319 100644 (file)
@@ -25,8 +25,8 @@
 #ifndef _VMCI_VERSION_H_
 #define _VMCI_VERSION_H_
 
-#define VMCI_DRIVER_VERSION          9.3.6.0
-#define VMCI_DRIVER_VERSION_COMMAS   9,3,6,0
-#define VMCI_DRIVER_VERSION_STRING   "9.3.6.0"
+#define VMCI_DRIVER_VERSION          9.3.7.0
+#define VMCI_DRIVER_VERSION_COMMAS   9,3,7,0
+#define VMCI_DRIVER_VERSION_STRING   "9.3.7.0"
 
 #endif /* _VMCI_VERSION_H_ */