VirtualBox

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


Ignore:
Timestamp:
Jan 18, 2022 10:38:27 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
149363
Message:

IPRT/ldrPE,pecoff.h: Another IMAGE_LOAD_CONFIG_DIRECTORY field.

File:
1 edited

Legend:

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

    r93115 r93295  
    38253825     * volatile everywhere! Trying to prevent the compiler being a smarta$$ and reorder stuff.
    38263826     */
    3827     IMAGE_LOAD_CONFIG_DIRECTORY32_V12 volatile *pLoadCfg32 = (IMAGE_LOAD_CONFIG_DIRECTORY32_V12 volatile *)pLoadCfg;
    3828     IMAGE_LOAD_CONFIG_DIRECTORY64_V12 volatile *pLoadCfg64 = pLoadCfg;
    3829 
    3830     pLoadCfg64->GuardXFGTableDispatchFunctionPointer = pLoadCfg32->GuardXFGTableDispatchFunctionPointer;
    3831     pLoadCfg64->GuardXFGDispatchFunctionPointer = pLoadCfg32->GuardXFGDispatchFunctionPointer;
    3832     pLoadCfg64->GuardXFGCheckFunctionPointer    = pLoadCfg32->GuardXFGCheckFunctionPointer;
    3833     pLoadCfg64->GuardEHContinuationCount        = pLoadCfg32->GuardEHContinuationCount;
    3834     pLoadCfg64->GuardEHContinuationTable        = pLoadCfg32->GuardEHContinuationTable;
    3835     pLoadCfg64->VolatileMetadataPointer         = pLoadCfg32->VolatileMetadataPointer;
    3836     pLoadCfg64->EnclaveConfigurationPointer     = pLoadCfg32->EnclaveConfigurationPointer;
    3837     pLoadCfg64->Reserved3                       = pLoadCfg32->Reserved3;
    3838     pLoadCfg64->HotPatchTableOffset             = pLoadCfg32->HotPatchTableOffset;
     3827    IMAGE_LOAD_CONFIG_DIRECTORY32_V13 volatile *pLoadCfg32 = (IMAGE_LOAD_CONFIG_DIRECTORY32_V13 volatile *)pLoadCfg;
     3828    IMAGE_LOAD_CONFIG_DIRECTORY64_V13 volatile *pLoadCfg64 = pLoadCfg;
     3829
     3830    pLoadCfg64->CastGuardOsDeterminedFailureMode         = pLoadCfg32->CastGuardOsDeterminedFailureMode;
     3831    pLoadCfg64->GuardXFGTableDispatchFunctionPointer     = pLoadCfg32->GuardXFGTableDispatchFunctionPointer;
     3832    pLoadCfg64->GuardXFGDispatchFunctionPointer          = pLoadCfg32->GuardXFGDispatchFunctionPointer;
     3833    pLoadCfg64->GuardXFGCheckFunctionPointer             = pLoadCfg32->GuardXFGCheckFunctionPointer;
     3834    pLoadCfg64->GuardEHContinuationCount                 = pLoadCfg32->GuardEHContinuationCount;
     3835    pLoadCfg64->GuardEHContinuationTable                 = pLoadCfg32->GuardEHContinuationTable;
     3836    pLoadCfg64->VolatileMetadataPointer                  = pLoadCfg32->VolatileMetadataPointer;
     3837    pLoadCfg64->EnclaveConfigurationPointer              = pLoadCfg32->EnclaveConfigurationPointer;
     3838    pLoadCfg64->Reserved3                                = pLoadCfg32->Reserved3;
     3839    pLoadCfg64->HotPatchTableOffset                      = pLoadCfg32->HotPatchTableOffset;
    38393840    pLoadCfg64->GuardRFVerifyStackPointerFunctionPointer = pLoadCfg32->GuardRFVerifyStackPointerFunctionPointer;
    3840     pLoadCfg64->Reserved2                       = pLoadCfg32->Reserved2;
    3841     pLoadCfg64->DynamicValueRelocTableSection   = pLoadCfg32->DynamicValueRelocTableSection;
    3842     pLoadCfg64->DynamicValueRelocTableOffset    = pLoadCfg32->DynamicValueRelocTableOffset;
    3843     pLoadCfg64->GuardRFFailureRoutineFunctionPointer = pLoadCfg32->GuardRFFailureRoutineFunctionPointer;
    3844     pLoadCfg64->GuardRFFailureRoutine           = pLoadCfg32->GuardRFFailureRoutine;
    3845     pLoadCfg64->CHPEMetadataPointer             = pLoadCfg32->CHPEMetadataPointer;
    3846     pLoadCfg64->DynamicValueRelocTable          = pLoadCfg32->DynamicValueRelocTable;
    3847     pLoadCfg64->GuardLongJumpTargetCount        = pLoadCfg32->GuardLongJumpTargetCount;
    3848     pLoadCfg64->GuardLongJumpTargetTable        = pLoadCfg32->GuardLongJumpTargetTable;
    3849     pLoadCfg64->GuardAddressTakenIatEntryCount  = pLoadCfg32->GuardAddressTakenIatEntryCount;
    3850     pLoadCfg64->GuardAddressTakenIatEntryTable  = pLoadCfg32->GuardAddressTakenIatEntryTable;
    3851     pLoadCfg64->CodeIntegrity.Reserved          = pLoadCfg32->CodeIntegrity.Reserved;
    3852     pLoadCfg64->CodeIntegrity.CatalogOffset     = pLoadCfg32->CodeIntegrity.CatalogOffset;
    3853     pLoadCfg64->CodeIntegrity.Catalog           = pLoadCfg32->CodeIntegrity.Catalog;
    3854     pLoadCfg64->CodeIntegrity.Flags             = pLoadCfg32->CodeIntegrity.Flags;
    3855     pLoadCfg64->GuardFlags                      = pLoadCfg32->GuardFlags;
    3856     pLoadCfg64->GuardCFFunctionCount            = pLoadCfg32->GuardCFFunctionCount;
    3857     pLoadCfg64->GuardCFFunctionTable            = pLoadCfg32->GuardCFFunctionTable;
    3858     pLoadCfg64->GuardCFDispatchFunctionPointer  = pLoadCfg32->GuardCFDispatchFunctionPointer;
    3859     pLoadCfg64->GuardCFCCheckFunctionPointer    = pLoadCfg32->GuardCFCCheckFunctionPointer;
    3860     pLoadCfg64->SEHandlerCount                  = pLoadCfg32->SEHandlerCount;
    3861     pLoadCfg64->SEHandlerTable                  = pLoadCfg32->SEHandlerTable;
    3862     pLoadCfg64->SecurityCookie                  = pLoadCfg32->SecurityCookie;
    3863     pLoadCfg64->EditList                        = pLoadCfg32->EditList;
    3864     pLoadCfg64->DependentLoadFlags              = pLoadCfg32->DependentLoadFlags;
    3865     pLoadCfg64->CSDVersion                      = pLoadCfg32->CSDVersion;
    3866     pLoadCfg64->ProcessHeapFlags                = pLoadCfg32->ProcessHeapFlags; /* switched place with ProcessAffinityMask, but we're more than 16 byte off by now so it doesn't matter. */
    3867     pLoadCfg64->ProcessAffinityMask             = pLoadCfg32->ProcessAffinityMask;
    3868     pLoadCfg64->VirtualMemoryThreshold          = pLoadCfg32->VirtualMemoryThreshold;
    3869     pLoadCfg64->MaximumAllocationSize           = pLoadCfg32->MaximumAllocationSize;
    3870     pLoadCfg64->LockPrefixTable                 = pLoadCfg32->LockPrefixTable;
    3871     pLoadCfg64->DeCommitTotalFreeThreshold      = pLoadCfg32->DeCommitTotalFreeThreshold;
    3872     uint32_t u32DeCommitFreeBlockThreshold      = pLoadCfg32->DeCommitFreeBlockThreshold;
    3873     pLoadCfg64->DeCommitFreeBlockThreshold      = u32DeCommitFreeBlockThreshold;
     3841    pLoadCfg64->Reserved2                                = pLoadCfg32->Reserved2;
     3842    pLoadCfg64->DynamicValueRelocTableSection            = pLoadCfg32->DynamicValueRelocTableSection;
     3843    pLoadCfg64->DynamicValueRelocTableOffset             = pLoadCfg32->DynamicValueRelocTableOffset;
     3844    pLoadCfg64->GuardRFFailureRoutineFunctionPointer     = pLoadCfg32->GuardRFFailureRoutineFunctionPointer;
     3845    pLoadCfg64->GuardRFFailureRoutine                    = pLoadCfg32->GuardRFFailureRoutine;
     3846    pLoadCfg64->CHPEMetadataPointer                      = pLoadCfg32->CHPEMetadataPointer;
     3847    pLoadCfg64->DynamicValueRelocTable                   = pLoadCfg32->DynamicValueRelocTable;
     3848    pLoadCfg64->GuardLongJumpTargetCount                 = pLoadCfg32->GuardLongJumpTargetCount;
     3849    pLoadCfg64->GuardLongJumpTargetTable                 = pLoadCfg32->GuardLongJumpTargetTable;
     3850    pLoadCfg64->GuardAddressTakenIatEntryCount           = pLoadCfg32->GuardAddressTakenIatEntryCount;
     3851    pLoadCfg64->GuardAddressTakenIatEntryTable           = pLoadCfg32->GuardAddressTakenIatEntryTable;
     3852    pLoadCfg64->CodeIntegrity.Reserved                   = pLoadCfg32->CodeIntegrity.Reserved;
     3853    pLoadCfg64->CodeIntegrity.CatalogOffset              = pLoadCfg32->CodeIntegrity.CatalogOffset;
     3854    pLoadCfg64->CodeIntegrity.Catalog                    = pLoadCfg32->CodeIntegrity.Catalog;
     3855    pLoadCfg64->CodeIntegrity.Flags                      = pLoadCfg32->CodeIntegrity.Flags;
     3856    pLoadCfg64->GuardFlags                               = pLoadCfg32->GuardFlags;
     3857    pLoadCfg64->GuardCFFunctionCount                     = pLoadCfg32->GuardCFFunctionCount;
     3858    pLoadCfg64->GuardCFFunctionTable                     = pLoadCfg32->GuardCFFunctionTable;
     3859    pLoadCfg64->GuardCFDispatchFunctionPointer           = pLoadCfg32->GuardCFDispatchFunctionPointer;
     3860    pLoadCfg64->GuardCFCCheckFunctionPointer             = pLoadCfg32->GuardCFCCheckFunctionPointer;
     3861    pLoadCfg64->SEHandlerCount                           = pLoadCfg32->SEHandlerCount;
     3862    pLoadCfg64->SEHandlerTable                           = pLoadCfg32->SEHandlerTable;
     3863    pLoadCfg64->SecurityCookie                           = pLoadCfg32->SecurityCookie;
     3864    pLoadCfg64->EditList                                 = pLoadCfg32->EditList;
     3865    pLoadCfg64->DependentLoadFlags                       = pLoadCfg32->DependentLoadFlags;
     3866    pLoadCfg64->CSDVersion                               = pLoadCfg32->CSDVersion;
     3867    pLoadCfg64->ProcessHeapFlags                         = pLoadCfg32->ProcessHeapFlags; /* switched place with ProcessAffinityMask, but we're more than 16 byte off by now so it doesn't matter. */
     3868    pLoadCfg64->ProcessAffinityMask                      = pLoadCfg32->ProcessAffinityMask;
     3869    pLoadCfg64->VirtualMemoryThreshold                   = pLoadCfg32->VirtualMemoryThreshold;
     3870    pLoadCfg64->MaximumAllocationSize                    = pLoadCfg32->MaximumAllocationSize;
     3871    pLoadCfg64->LockPrefixTable                          = pLoadCfg32->LockPrefixTable;
     3872    pLoadCfg64->DeCommitTotalFreeThreshold               = pLoadCfg32->DeCommitTotalFreeThreshold;
     3873    uint32_t u32DeCommitFreeBlockThreshold               = pLoadCfg32->DeCommitFreeBlockThreshold;
     3874    pLoadCfg64->DeCommitFreeBlockThreshold               = u32DeCommitFreeBlockThreshold;
    38743875    /* the rest is equal. */
    38753876    Assert(     RT_UOFFSETOF(IMAGE_LOAD_CONFIG_DIRECTORY32, DeCommitFreeBlockThreshold)
     
    44554456    if (Dir.Size)
    44564457    {
     4458        const size_t cbExpectV13 = !pModPe->f64Bit
     4459                                 ? sizeof(IMAGE_LOAD_CONFIG_DIRECTORY32_V13)
     4460                                 : sizeof(IMAGE_LOAD_CONFIG_DIRECTORY64_V13);
    44574461        const size_t cbExpectV12 = !pModPe->f64Bit
    44584462                                 ? sizeof(IMAGE_LOAD_CONFIG_DIRECTORY32_V12)
     
    44954499
    44964500        bool fNewerStructureHack = false;
    4497         if (   Dir.Size != cbExpectV12
     4501        if (   Dir.Size != cbExpectV13
     4502            && Dir.Size != cbExpectV12
    44984503            && Dir.Size != cbExpectV11
    44994504            && Dir.Size != cbExpectV10
     
    45104515            fNewerStructureHack = Dir.Size > cbNewHack /* These structure changes are slowly getting to us! More futher down. */
    45114516                               && Dir.Size <= sizeof(u);
    4512             Log(("rtldrPEOpen: %s: load cfg dir: unexpected dir size of %u bytes, expected %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu.%s\n",
    4513                  pszLogName, Dir.Size, cbExpectV12, cbExpectV11, cbExpectV10, cbExpectV9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1,
     4517            Log(("rtldrPEOpen: %s: load cfg dir: unexpected dir size of %u bytes, expected %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu.%s\n",
     4518                 pszLogName, Dir.Size, cbExpectV13, cbExpectV12, cbExpectV11, cbExpectV10, cbExpectV9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1,
    45144519                 fNewerStructureHack ? " Will try ignore extra bytes if all zero." : ""));
    45154520            if (!fNewerStructureHack)
    45164521                return RTErrInfoSetF(pErrInfo, VERR_LDRPE_LOAD_CONFIG_SIZE,
    4517                                      "Unexpected load config dir size of %u bytes; supported sized: %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu",
    4518                                      Dir.Size, cbExpectV12, cbExpectV11, cbExpectV10, cbExpectV9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1);
     4522                                     "Unexpected load config dir size of %u bytes; supported sized: %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu",
     4523                                     Dir.Size, cbExpectV13, cbExpectV12, cbExpectV11, cbExpectV10, cbExpectV9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1);
    45194524        }
    45204525
     
    45554560            /* Kludge #2: This happens a lot. Structure changes, but the linker doesn't get
    45564561               updated and stores some old size in the directory.  Use the header size. */
    4557             else if (   u.Cfg64.Size == cbExpectV12
     4562            else if (   u.Cfg64.Size == cbExpectV13
     4563                     || u.Cfg64.Size == cbExpectV12
    45584564                     || u.Cfg64.Size == cbExpectV11
    45594565                     || u.Cfg64.Size == cbExpectV10
Note: See TracChangeset for help on using the changeset viewer.

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