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
*
* 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.
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_ */
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.
#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
-}
-
-
/*
*----------------------------------------------------------------------
*
VMCI_ReleaseLock(&contextList.lock, flags);
#ifdef VMKERNEL
- /*
- * Set default domain name.
- */
- VMCIContext_SetDomainName(context, "");
VMCIContext_SetFSRState(context, FALSE, VMCI_INVALID_ID, eventHnd, FALSE);
#endif
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
static int
VMCIContextFireNotification(VMCIId contextID, // IN
- VMCIPrivilegeFlags privFlags, // IN
- const char *domain) // IN
+ VMCIPrivilegeFlags privFlags) // IN
{
uint32 i, arraySize;
VMCIListItem *next;
*/
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));
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 "
srcPrivFlags = VMCIContext_GetPrivFlags(srcCID);
}
- if (VMCIDenyInteraction(srcPrivFlags, dstPrivFlags, srcDomain,
- VMCIContextGetDomainName(dstContext))) {
+ if (VMCIDenyInteraction(srcPrivFlags, dstPrivFlags)) {
result = VMCI_ERROR_NO_ACCESS;
goto out;
}
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)
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,
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());
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. */
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;
}
/* 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;
}
}
-/*
- *-----------------------------------------------------------------------------
- *
- * 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
-}
-
-
/*
*-----------------------------------------------------------------------------
*
* 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;
}
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
#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_ */