Changeset 66844 in vbox for trunk/src/VBox/HostDrivers/Support/posix
- Timestamp:
- May 9, 2017 9:27:32 AM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 115302
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/posix/SUPR3HardenedMain-posix.cpp
r66843 r66844 369 369 370 370 /* 371 * Each relative call requires extra bytes as it is converted to two push imm32371 * Each relative call requires extra bytes as it is converted to a push imm64 372 372 * + a jmp qword [$+8 wrt RIP] to avoid clobbering registers. 373 373 */ 374 cbPatchMem += cRelCalls * RT_ALIGN_32( 2 * 5+ 6 + 8, 8);374 cbPatchMem += cRelCalls * RT_ALIGN_32(9 + 6 + 8, 8); 375 375 cbPatchMem += 14; /* jmp qword [$+8 wrt RIP] + 8 byte address to jump to. */ 376 376 cbPatchMem = RT_ALIGN_32(cbPatchMem, 8); … … 457 457 uintptr_t uAddr = (uintptr_t)&pbTarget[offInsn + cbInstr] + (intptr_t)Dis.Param1.uValue; 458 458 459 /* Skip the first twopush instructions till the return address is known. */459 /* Skip the initial push instructions till the return address is known. */ 460 460 uint8_t *pbPatchMemPush = pbPatchMem; 461 pbPatchMem += 2 * 5;461 pbPatchMem += 9; 462 462 463 463 *pbPatchMem++ = 0xff; /* jmp qword [$+8 wrt RIP] */ … … 468 468 pbPatchMem += sizeof(uint64_t); 469 469 470 /* Create two pushes now which will putthe return address onto the stack. */470 /* Push the return address onto the stack. */ 471 471 uintptr_t uAddrReturn = (uintptr_t)pbPatchMem; 472 *pbPatchMemPush++ = 0x68; /* push imm32 */ 473 *(uint32_t *)pbPatchMemPush = (uint32_t)(uAddrReturn >> 32); 474 pbPatchMemPush += sizeof(uint32_t); 475 476 *pbPatchMemPush++ = 0x68; /* push imm32 */ 477 *(uint32_t *)pbPatchMemPush = (uint32_t)uAddrReturn; 478 pbPatchMemPush += sizeof(uint32_t); 472 *pbPatchMemPush++ = 0x68; /* push imm64 */ 473 *(uint64_t *)pbPatchMemPush = uAddrReturn; 479 474 } 480 475 else
Note:
See TracChangeset
for help on using the changeset viewer.