VirtualBox

Changeset 29980 in vbox


Ignore:
Timestamp:
Jun 2, 2010 11:44:51 AM (15 years ago)
Author:
vboxsync
Message:

Check by module name and version for win64 guests as it's unlikely two guests will share the same virtual address space layout for dlls and kernel modules

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/GMMR0.cpp

    r29741 r29980  
    34743474}
    34753475
     3476typedef struct
     3477{
     3478    PAVLGCPTRNODECORE    pNode;
     3479    char                *pszModuleName;
     3480    char                *pszVersion;
     3481    VBOXOSFAMILY         enmGuestOS;
     3482} GMMFINDMODULEBYNAME, *PGMMFINDMODULEBYNAME;
     3483
     3484/**
     3485 * Tree enumeration callback for finding identical modules by name and version
     3486 */
     3487DECLCALLBACK(int) gmmR0CheckForIdenticalModule(PAVLGCPTRNODECORE pNode, void *pvUser)
     3488{
     3489    PGMMFINDMODULEBYNAME pInfo = (PGMMFINDMODULEBYNAME)pvUser;
     3490    PGMMSHAREDMODULE     pModule = (PGMMSHAREDMODULE)pNode;
     3491
     3492    if (    pInfo
     3493        &&  pInfo->enmGuestOS == pModule->enmGuestOS
     3494        /** todo replace with RTStrNCmp */
     3495        &&  !strcmp(pModule->szName, pInfo->pszModuleName)
     3496        &&  !strcmp(pModule->szVersion, pInfo->pszVersion))
     3497    {
     3498        pInfo->pNode = pNode;
     3499        return 1;   /* stop search */
     3500    }
     3501    return 0;
     3502}
     3503
    34763504
    34773505/**
     
    35383566        /* Check if this module is already globally registered. */
    35393567        PGMMSHAREDMODULE pGlobalModule = (PGMMSHAREDMODULE)RTAvlGCPtrGet(&pGMM->pGlobalSharedModuleTree, GCBaseAddr);
     3568        if (    !pGlobalModule
     3569            &&  enmGuestOS == VBOXOSFAMILY_Windows64)
     3570        {
     3571            /* Two identical copies of e.g. Win7 x64 will typically not have a similar virtual address space layout for dlls or kernel modules.
     3572             * Try to find identical binaries based on name and version.
     3573             */
     3574            GMMFINDMODULEBYNAME Info;
     3575
     3576            Info.pNode         = NULL;
     3577            Info.pszVersion    = pszVersion;
     3578            Info.pszModuleName = pszModuleName;
     3579            Info.enmGuestOS    = enmGuestOS;
     3580
     3581            int ret = RTAvlGCPtrDoWithAll(&pGMM->pGlobalSharedModuleTree, true /* fFromLeft */, gmmR0CheckForIdenticalModule, &Info);
     3582            if (ret == 1)
     3583            {
     3584                Assert(Info.pNode);
     3585                pGlobalModule = (PGMMSHAREDMODULE)Info.pNode;
     3586            }
     3587        }
     3588
    35403589        if (!pGlobalModule)
    35413590        {
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