VirtualBox

Changeset 67948 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
Jul 13, 2017 10:00:40 AM (7 years ago)
Author:
vboxsync
Message:

pecoff,ldrPE: Another load config change surfaced in build 16237, 64-bit bcrypt*.dll uses it while 32-bit doesn't. Sigh.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/ldr/ldrPE.cpp

    r66367 r67948  
    30393039     * volatile everywhere! Trying to prevent the compiler being a smarta$$ and reorder stuff.
    30403040     */
    3041     IMAGE_LOAD_CONFIG_DIRECTORY32_V8 volatile *pLoadCfg32 = (IMAGE_LOAD_CONFIG_DIRECTORY32_V8 volatile *)pLoadCfg;
    3042     IMAGE_LOAD_CONFIG_DIRECTORY64_V8 volatile *pLoadCfg64 = pLoadCfg;
    3043 
     3041    IMAGE_LOAD_CONFIG_DIRECTORY32_V9 volatile *pLoadCfg32 = (IMAGE_LOAD_CONFIG_DIRECTORY32_V9 volatile *)pLoadCfg;
     3042    IMAGE_LOAD_CONFIG_DIRECTORY64_V9 volatile *pLoadCfg64 = pLoadCfg;
     3043
     3044    pLoadCfg64->AddressOfSomeUnicodeString      = pLoadCfg32->AddressOfSomeUnicodeString;
    30443045    pLoadCfg64->HotPatchTableOffset             = pLoadCfg32->HotPatchTableOffset;
    30453046    pLoadCfg64->GuardRFVerifyStackPointerFunctionPointer = pLoadCfg32->GuardRFVerifyStackPointerFunctionPointer;
     
    36053606    if (Dir.Size)
    36063607    {
     3608        const size_t cbExpectV9 = !pModPe->f64Bit
     3609                                ? sizeof(IMAGE_LOAD_CONFIG_DIRECTORY32_V9)
     3610                                : sizeof(IMAGE_LOAD_CONFIG_DIRECTORY64_V9);
    36073611        const size_t cbExpectV8 = !pModPe->f64Bit
    36083612                                ? sizeof(IMAGE_LOAD_CONFIG_DIRECTORY32_V8)
     
    36303634                                : sizeof(IMAGE_LOAD_CONFIG_DIRECTORY64_V2) /*No V1*/;
    36313635        const size_t cbNewHack  = cbExpectV5; /* Playing safe here since there might've been revisions between V5 and V6 we don't know about . */
    3632         const size_t cbMaxKnown = cbExpectV8;
     3636        const size_t cbMaxKnown = cbExpectV9;
    36333637
    36343638        bool fNewerStructureHack = false;
    3635         if (   Dir.Size != cbExpectV8
     3639        if (   Dir.Size != cbExpectV9
     3640            && Dir.Size != cbExpectV8
    36363641            && Dir.Size != cbExpectV7
    36373642            && Dir.Size != cbExpectV6
     
    36443649            fNewerStructureHack = Dir.Size > cbNewHack /* These structure changes are slowly getting to us! More futher down. */
    36453650                               && Dir.Size <= sizeof(u);
    3646             Log(("rtldrPEOpen: %s: load cfg dir: unexpected dir size of %u bytes, expected %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu.%s\n",
    3647                  pszLogName, Dir.Size, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1,
     3651            Log(("rtldrPEOpen: %s: load cfg dir: unexpected dir size of %u bytes, expected %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu.%s\n",
     3652                 pszLogName, Dir.Size, cbExpectV9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1,
    36483653                 fNewerStructureHack ? " Will try ignore extra bytes if all zero." : ""));
    36493654            if (!fNewerStructureHack)
    36503655                return RTErrInfoSetF(pErrInfo, VERR_LDRPE_LOAD_CONFIG_SIZE,
    3651                                      "Unexpected load config dir size of %u bytes; supported sized: %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu",
    3652                                      Dir.Size, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1);
     3656                                     "Unexpected load config dir size of %u bytes; supported sized: %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu",
     3657                                     Dir.Size, cbExpectV9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1);
    36533658        }
    36543659
     
    36883693            /* Kludge #2: This happens a lot. Structure changes, but the linker doesn't get
    36893694               updated and stores some old size in the directory.  Use the header size. */
    3690             else if (   u.Cfg64.Size == cbExpectV8
     3695            else if (   u.Cfg64.Size == cbExpectV9
     3696                     || u.Cfg64.Size == cbExpectV8
    36913697                     || u.Cfg64.Size == cbExpectV7
    36923698                     || u.Cfg64.Size == cbExpectV6
     
    37243730            else
    37253731            {
    3726                 Log(("rtldrPEOpen: %s: load cfg hdr: unexpected hdr size of %u bytes (dir %u), expected %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu.\n",
    3727                      pszLogName, u.Cfg64.Size, Dir.Size, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1));
     3732                Log(("rtldrPEOpen: %s: load cfg hdr: unexpected hdr size of %u bytes (dir %u), expected %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu.\n",
     3733                     pszLogName, u.Cfg64.Size, Dir.Size, cbExpectV9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1));
    37283734                return RTErrInfoSetF(pErrInfo, VERR_LDRPE_LOAD_CONFIG_SIZE,
    3729                                      "Unexpected load config header size of %u bytes (dir %u); supported sized: %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu",
    3730                                      u.Cfg64.Size, Dir.Size, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1);
     3735                                     "Unexpected load config header size of %u bytes (dir %u); supported sized: %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu",
     3736                                     u.Cfg64.Size, Dir.Size, cbExpectV9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1);
    37313737            }
    37323738        }
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