VirtualBox

Ignore:
Timestamp:
May 9, 2017 9:27:32 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
115302
Message:

Support/posix: Just use push imm64...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/posix/SUPR3HardenedMain-posix.cpp

    r66843 r66844  
    369369
    370370    /*
    371      * Each relative call requires extra bytes as it is converted to two push imm32
     371     * Each relative call requires extra bytes as it is converted to a push imm64
    372372     * + a jmp qword [$+8 wrt RIP] to avoid clobbering registers.
    373373     */
    374     cbPatchMem += cRelCalls * RT_ALIGN_32(2 * 5 + 6 + 8, 8);
     374    cbPatchMem += cRelCalls * RT_ALIGN_32(9 + 6 + 8, 8);
    375375    cbPatchMem += 14; /* jmp qword [$+8 wrt RIP] + 8 byte address to jump to. */
    376376    cbPatchMem = RT_ALIGN_32(cbPatchMem, 8);
     
    457457            uintptr_t uAddr = (uintptr_t)&pbTarget[offInsn + cbInstr] + (intptr_t)Dis.Param1.uValue;
    458458
    459             /* Skip the first two push instructions till the return address is known. */
     459            /* Skip the initial push instructions till the return address is known. */
    460460            uint8_t *pbPatchMemPush = pbPatchMem;
    461             pbPatchMem += 2 * 5;
     461            pbPatchMem += 9;
    462462
    463463            *pbPatchMem++ = 0xff; /* jmp qword [$+8 wrt RIP] */
     
    468468            pbPatchMem += sizeof(uint64_t);
    469469
    470             /* Create two pushes now which will put the return address onto the stack. */
     470            /* Push the return address onto the stack. */
    471471            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;
    479474        }
    480475        else
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