Changeset 84361 in vbox for trunk/src/VBox
- Timestamp:
- May 19, 2020 9:47:34 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/ldr/ldrPE.cpp
r82968 r84361 3586 3586 * volatile everywhere! Trying to prevent the compiler being a smarta$$ and reorder stuff. 3587 3587 */ 3588 IMAGE_LOAD_CONFIG_DIRECTORY32_V9 volatile *pLoadCfg32 = (IMAGE_LOAD_CONFIG_DIRECTORY32_V9 volatile *)pLoadCfg; 3589 IMAGE_LOAD_CONFIG_DIRECTORY64_V9 volatile *pLoadCfg64 = pLoadCfg; 3590 3591 pLoadCfg64->AddressOfSomeUnicodeString = pLoadCfg32->AddressOfSomeUnicodeString; 3588 IMAGE_LOAD_CONFIG_DIRECTORY32_V12 volatile *pLoadCfg32 = (IMAGE_LOAD_CONFIG_DIRECTORY32_V12 volatile *)pLoadCfg; 3589 IMAGE_LOAD_CONFIG_DIRECTORY64_V12 volatile *pLoadCfg64 = pLoadCfg; 3590 3591 pLoadCfg64->GuardXFGTableDispatchFunctionPointer = pLoadCfg32->GuardXFGTableDispatchFunctionPointer; 3592 pLoadCfg64->GuardXFGDispatchFunctionPointer = pLoadCfg32->GuardXFGDispatchFunctionPointer; 3593 pLoadCfg64->GuardXFGCheckFunctionPointer = pLoadCfg32->GuardXFGCheckFunctionPointer; 3594 pLoadCfg64->GuardEHContinuationCount = pLoadCfg32->GuardEHContinuationCount; 3595 pLoadCfg64->GuardEHContinuationTable = pLoadCfg32->GuardEHContinuationTable; 3596 pLoadCfg64->VolatileMetadataPointer = pLoadCfg32->VolatileMetadataPointer; 3597 pLoadCfg64->EnclaveConfigurationPointer = pLoadCfg32->EnclaveConfigurationPointer; 3598 pLoadCfg64->Reserved3 = pLoadCfg32->Reserved3; 3592 3599 pLoadCfg64->HotPatchTableOffset = pLoadCfg32->HotPatchTableOffset; 3593 3600 pLoadCfg64->GuardRFVerifyStackPointerFunctionPointer = pLoadCfg32->GuardRFVerifyStackPointerFunctionPointer; … … 4209 4216 if (Dir.Size) 4210 4217 { 4218 const size_t cbExpectV12 = !pModPe->f64Bit 4219 ? sizeof(IMAGE_LOAD_CONFIG_DIRECTORY32_V12) 4220 : sizeof(IMAGE_LOAD_CONFIG_DIRECTORY64_V12); 4221 const size_t cbExpectV11 = !pModPe->f64Bit 4222 ? sizeof(IMAGE_LOAD_CONFIG_DIRECTORY32_V11) 4223 : sizeof(IMAGE_LOAD_CONFIG_DIRECTORY64_V11); 4224 const size_t cbExpectV10 = !pModPe->f64Bit 4225 ? sizeof(IMAGE_LOAD_CONFIG_DIRECTORY32_V10) 4226 : sizeof(IMAGE_LOAD_CONFIG_DIRECTORY64_V10); 4211 4227 const size_t cbExpectV9 = !pModPe->f64Bit 4212 4228 ? sizeof(IMAGE_LOAD_CONFIG_DIRECTORY32_V9) … … 4237 4253 : sizeof(IMAGE_LOAD_CONFIG_DIRECTORY64_V2) /*No V1*/; 4238 4254 const size_t cbNewHack = cbExpectV5; /* Playing safe here since there might've been revisions between V5 and V6 we don't know about . */ 4239 const size_t cbMaxKnown = cbExpectV 9;4255 const size_t cbMaxKnown = cbExpectV12; 4240 4256 4241 4257 bool fNewerStructureHack = false; 4242 if ( Dir.Size != cbExpectV9 4258 if ( Dir.Size != cbExpectV12 4259 && Dir.Size != cbExpectV11 4260 && Dir.Size != cbExpectV10 4261 && Dir.Size != cbExpectV9 4243 4262 && Dir.Size != cbExpectV8 4244 4263 && Dir.Size != cbExpectV7 … … 4252 4271 fNewerStructureHack = Dir.Size > cbNewHack /* These structure changes are slowly getting to us! More futher down. */ 4253 4272 && Dir.Size <= sizeof(u); 4254 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",4255 pszLogName, Dir.Size, cbExpectV 9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1,4273 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", 4274 pszLogName, Dir.Size, cbExpectV12, cbExpectV11, cbExpectV10, cbExpectV9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1, 4256 4275 fNewerStructureHack ? " Will try ignore extra bytes if all zero." : "")); 4257 4276 if (!fNewerStructureHack) 4258 4277 return RTErrInfoSetF(pErrInfo, VERR_LDRPE_LOAD_CONFIG_SIZE, 4259 "Unexpected load config dir size of %u bytes; supported sized: %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu",4260 Dir.Size, cbExpectV 9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1);4278 "Unexpected load config dir size of %u bytes; supported sized: %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu", 4279 Dir.Size, cbExpectV12, cbExpectV11, cbExpectV10, cbExpectV9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1); 4261 4280 } 4262 4281 … … 4297 4316 /* Kludge #2: This happens a lot. Structure changes, but the linker doesn't get 4298 4317 updated and stores some old size in the directory. Use the header size. */ 4299 else if ( u.Cfg64.Size == cbExpectV9 4318 else if ( u.Cfg64.Size == cbExpectV12 4319 || u.Cfg64.Size == cbExpectV11 4320 || u.Cfg64.Size == cbExpectV10 4321 || u.Cfg64.Size == cbExpectV9 4300 4322 || u.Cfg64.Size == cbExpectV8 4301 4323 || u.Cfg64.Size == cbExpectV7 … … 4335 4357 else 4336 4358 { 4337 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",4338 pszLogName, u.Cfg64.Size, Dir.Size, cbExpectV 9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1));4359 Log(("rtldrPEOpen: %s: load cfg hdr: unexpected hdr size of %u bytes (dir %u), expected %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu.\n", 4360 pszLogName, u.Cfg64.Size, Dir.Size, cbExpectV12, cbExpectV11, cbExpectV10, cbExpectV9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1)); 4339 4361 return RTErrInfoSetF(pErrInfo, VERR_LDRPE_LOAD_CONFIG_SIZE, 4340 "Unexpected load config header size of %u bytes (dir %u); supported sized: %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu",4341 u.Cfg64.Size, Dir.Size, cbExpectV 9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1);4362 "Unexpected load config header size of %u bytes (dir %u); supported sized: %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, %zu, or %zu", 4363 u.Cfg64.Size, Dir.Size, cbExpectV12, cbExpectV11, cbExpectV10, cbExpectV9, cbExpectV8, cbExpectV7, cbExpectV6, cbExpectV5, cbExpectV4, cbExpectV3, cbExpectV2, cbExpectV1); 4342 4364 } 4343 4365 }
Note:
See TracChangeset
for help on using the changeset viewer.