VirtualBox

Changeset 57650 in vbox for trunk/src/VBox/HostDrivers


Ignore:
Timestamp:
Sep 8, 2015 2:35:19 AM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
102543
Message:

supHardNt: Adjustment for 64-bit Windows 10 build 10525 and later.

Location:
trunk/src/VBox/HostDrivers/Support/win
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/win/SUPR3HardenedMainA-win.asm

    r56732 r57650  
    164164        ret
    165165ENDPROC %1 %+ _SyscallType1
     166BEGINPROC %1 %+ _SyscallType2 ; Introduced with build 10525
     167        SEH64_END_PROLOGUE
     168        mov     eax, [NAME(g_uApiNo %+ %1) xWrtRIP]
     169        test    byte [07ffe0308h], 1    ; SharedUserData!Something
     170        mov     r10, rcx
     171        jnz     .int_alternative
     172        syscall
     173        ret
     174.int_alternative:
     175        int     2eh
     176        ret
     177ENDPROC %1 %+ _SyscallType2
    166178 %else
    167179BEGINPROC %1 %+ _SyscallType1
  • trunk/src/VBox/HostDrivers/Support/win/SUPR3HardenedMainImports-win.cpp

    r57358 r57650  
    9393    /** Assembly system call routine, type 1.  */
    9494    PFNRT                   pfnType1;
    95 #ifdef RT_ARCH_X86
    9695    /** Assembly system call routine, type 2.  */
    9796    PFNRT                   pfnType2;
     97#ifdef RT_ARCH_X86
    9898    /** The parameter size in bytes for a standard call. */
    9999    uint32_t                cbParams;
     
    221221    { NULL, NULL },
    222222# define SUPHARNT_IMPORT_SYSCALL(a_Name, a_cbParamsX86) \
    223     { &RT_CONCAT(g_uApiNo, a_Name), &RT_CONCAT(a_Name, _SyscallType1) },
     223    { &RT_CONCAT(g_uApiNo, a_Name), &RT_CONCAT(a_Name, _SyscallType1), &RT_CONCAT(a_Name, _SyscallType2) },
    224224#elif defined(RT_ARCH_X86)
    225225# define SUPHARNT_IMPORT_STDCALL(a_Name, a_cbParamsX86) \
     
    457457     */
    458458#ifdef RT_ARCH_AMD64
    459     /* Pattern #1: XP64/W2K3-64 thru Windows 8.1
    460        0:000> u ntdll!NtCreateSection
    461        ntdll!NtCreateSection:
    462        00000000`779f1750 4c8bd1          mov     r10,rcx
    463        00000000`779f1753 b847000000      mov     eax,47h
    464        00000000`779f1758 0f05            syscall
    465        00000000`779f175a c3              ret
    466        00000000`779f175b 0f1f440000      nop     dword ptr [rax+rax] */
     459    /* Pattern #1: XP64/W2K3-64 thru Windows 10 build 10240.
     460            0:000> u ntdll!NtCreateSection
     461            ntdll!NtCreateSection:
     462            00000000`779f1750 4c8bd1          mov     r10,rcx
     463            00000000`779f1753 b847000000      mov     eax,47h
     464            00000000`779f1758 0f05            syscall
     465            00000000`779f175a c3              ret
     466            00000000`779f175b 0f1f440000      nop     dword ptr [rax+rax]
     467
     468       Pattern #2: Windows 10 build 10525+.
     469            0:000> u ntdll_7ffc26300000!NtCreateSection
     470            ntdll_7ffc26300000!ZwCreateSection:
     471            00007ffc`263943e0 4c8bd1          mov     r10,rcx
     472            00007ffc`263943e3 b84a000000      mov     eax,4Ah
     473            00007ffc`263943e8 f604250803fe7f01 test    byte ptr [SharedUserData+0x308 (00000000`7ffe0308)],1
     474            00007ffc`263943f0 7503            jne     ntdll_7ffc26300000!ZwCreateSection+0x15 (00007ffc`263943f5)
     475            00007ffc`263943f2 0f05            syscall
     476            00007ffc`263943f4 c3              ret
     477            00007ffc`263943f5 cd2e            int     2Eh
     478            00007ffc`263943f7 c3              ret
     479       */
    467480    if (   pbFunction[ 0] == 0x4c /* mov r10, rcx */
    468481        && pbFunction[ 1] == 0x8b
     
    472485        //&& pbFunction[ 5] == 0xYY
    473486        && pbFunction[ 6] == 0x00
    474         && pbFunction[ 7] == 0x00
    475         && pbFunction[ 8] == 0x0f /* syscall */
    476         && pbFunction[ 9] == 0x05
    477         && pbFunction[10] == 0xc3 /* ret */ )
     487        && pbFunction[ 7] == 0x00)
    478488    {
    479         *pSyscall->puApiNo = RT_MAKE_U16(pbFunction[4], pbFunction[5]);
    480         *pImport->ppfnImport = pSyscall->pfnType1;
    481         return;
     489        if (   pbFunction[ 8] == 0x0f /* syscall */
     490            && pbFunction[ 9] == 0x05
     491            && pbFunction[10] == 0xc3 /* ret */ )
     492        {
     493            *pSyscall->puApiNo = RT_MAKE_U16(pbFunction[4], pbFunction[5]);
     494            *pImport->ppfnImport = pSyscall->pfnType1;
     495            return;
     496        }
     497        if (   pbFunction[ 8] == 0xf6 /* test   byte ptr [SharedUserData+0x308 (00000000`7ffe0308)],1 */
     498            && pbFunction[ 9] == 0x04
     499            && pbFunction[10] == 0x25
     500            && pbFunction[11] == 0x08
     501            && pbFunction[12] == 0x03
     502            && pbFunction[13] == 0xfe
     503            && pbFunction[14] == 0x7f
     504            && pbFunction[15] == 0x01
     505            && pbFunction[16] == 0x75 /* jnz +3 */
     506            && pbFunction[17] == 0x03
     507            && pbFunction[18] == 0x0f /* syscall*/
     508            && pbFunction[19] == 0x05
     509            && pbFunction[20] == 0xc3 /* ret */
     510            && pbFunction[21] == 0xcd /* int 2eh */
     511            && pbFunction[22] == 0x2e
     512            && pbFunction[23] == 0xc3 /* ret */ )
     513        {
     514            *pSyscall->puApiNo = RT_MAKE_U16(pbFunction[4], pbFunction[5]);
     515            *pImport->ppfnImport = pSyscall->pfnType2;
     516            return;
     517        }
    482518    }
    483519#else
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