VirtualBox

Ignore:
Timestamp:
Nov 4, 2021 12:29:20 AM (3 years ago)
Author:
vboxsync
Message:

SUPDrv-win.cpp: Debugged and enabled the VBOXDRV_WITH_SID_TO_UID_MAPPING code. bugref:10093

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp

    r91789 r92203  
    9292/** Enables generating UID from NT SIDs so the GMM can share free memory
    9393 *  among VMs running as the same user. */
    94 //#define VBOXDRV_WITH_SID_TO_UID_MAPPING
     94#define VBOXDRV_WITH_SID_TO_UID_MAPPING
    9595
    9696/* Missing if we're compiling against older WDKs. */
     
    875875         */
    876876        UNICODE_STRING UniStr = RTNT_NULL_UNISTR();
    877         rcNt = RtlConvertSidToUnicodeString(&UniStr, &pTokenUser->User.Sid, TRUE /*AllocateDesitnationString*/);
     877        rcNt = RtlConvertSidToUnicodeString(&UniStr, pTokenUser->User.Sid, TRUE /*AllocateDesitnationString*/);
    878878        if (NT_SUCCESS(rcNt))
    879879        {
     
    892892                        pNtUserIdNew->cchSid       = (uint16_t)cchSid;
    893893                        pNtUserIdNew->cRefs        = 1;
     894                        Log5Func(("pNtUserId=%p cchSid=%u hash=%#x '%s'\n", pNtUserIdNew, cchSid, pNtUserIdNew->HashCore.Key, pszSid));
    894895
    895896                        /*
     
    910911                            {
    911912                                /* Found matching: Retain reference and free the new entry we prepared. */
    912                                 uint32_t cRefs = ASMAtomicIncU32(&pNtUserId->cRefs);
    913                                 Assert(cRefs < _16K);
     913                                uint32_t const cRefs = ASMAtomicIncU32(&pNtUserId->cRefs);
     914                                Assert(cRefs < _16K); RT_NOREF(cRefs);
    914915                                RTSpinlockRelease(g_hNtUserIdLock);
     916                                Log5Func(("Using %p / %#x instead\n", pNtUserId, pNtUserId->UidCore.Key));
    915917                            }
    916918                            else
     
    924926                                }
    925927                                RTSpinlockRelease(g_hNtUserIdLock);
     928                                if (pNtUserId)
     929                                    Log5Func(("Using %p / %#x (the prepared one)\n", pNtUserId, pNtUserId->UidCore.Key));
     930                                else
     931                                    LogRelFunc(("supdrvNtUserIdMakeForSession: failed to insert new\n"));
    926932                            }
    927933                        }
     
    936942                            }
    937943                            RTSpinlockRelease(g_hNtUserIdLock);
     944                            if (pNtUserId)
     945                                Log5Func(("Using %p / %#x (the prepared one, no conflict)\n", pNtUserId, pNtUserId->UidCore.Key));
     946                            else
     947                                LogRelFunc(("failed to insert!! WTF!?!\n"));
    938948                        }
    939949
     
    956966        }
    957967        else
     968        {
    958969            rc = RTErrConvertFromNtStatus(rcNt);
     970            LogFunc(("RtlConvertSidToUnicodeString failed: %#x / %Rrc\n", rcNt, rc));
     971        }
    959972        ExFreePool(pTokenUser);
    960973    }
    961974    else
     975    {
    962976        rc = RTErrConvertFromNtStatus(rcNt);
     977        LogFunc(("SeQueryInformationToken failed: %#x / %Rrc\n", rcNt, rc));
     978    }
    963979
    964980    SeReleaseSubjectContext(&Ctx);
     
    976992    if (pNtUserId)
    977993    {
    978         uint32_t cRefs = ASMAtomicDecU32(&pNtUserId->cRefs);
     994        uint32_t const cRefs = ASMAtomicDecU32(&pNtUserId->cRefs);
     995        Log5Func(("%p / %#x: cRefs=%d\n", pNtUserId, pNtUserId->cRefs));
    979996        Assert(cRefs < _8K);
    980997        if (cRefs == 0)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette