VirtualBox

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


Ignore:
Timestamp:
Feb 25, 2016 2:48:09 AM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
105692
Message:

supR3HardenedWinInitVersion: Don't call RtlGetVersion during early init, it may touch NTDLL BSS data and cause VERR_SUP_VP_MEMORY_VS_FILE_MISMATCH when opening our kernel driver. Problem started with windows 10 build 14267.

Location:
trunk/src/VBox/HostDrivers/Support
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPLibInternal.h

    r56817 r59810  
    452452DECLHIDDEN(void)    supR3HardenedWinInit(uint32_t fFlags, bool fAvastKludge);
    453453DECLHIDDEN(void)    supR3HardenedWinInitAppBin(uint32_t fFlags);
    454 DECLHIDDEN(void)    supR3HardenedWinInitVersion(void);
     454DECLHIDDEN(void)    supR3HardenedWinInitVersion(bool fEarlyInit);
    455455DECLHIDDEN(void)    supR3HardenedWinInitImports(void);
    456456DECLHIDDEN(void)    supR3HardenedWinModifyDllSearchPath(uint32_t fFlags, const char *pszAppBinPath);
  • trunk/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyImage-win.cpp

    r58731 r59810  
    27722772 * Called from suplibHardenedWindowsMain and suplibOsInit.
    27732773 */
    2774 DECLHIDDEN(void) supR3HardenedWinInitVersion(void)
     2774DECLHIDDEN(void) supR3HardenedWinInitVersion(bool fEarly)
    27752775{
    27762776    /*
     
    27782778     * GetVersion might not be telling the whole truth (8.0 on 8.1 depending on
    27792779     * the application manifest).
     2780     *
     2781     * Note! Windows 10 build 14267+ touches BSS when calling RtlGetVersion, so we
     2782     *       have to use the fallback for the call from the early init code.
    27802783     */
    27812784    OSVERSIONINFOEXW NtVerInfo;
     
    27832786    RT_ZERO(NtVerInfo);
    27842787    NtVerInfo.dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOEXW);
    2785     if (!NT_SUCCESS(RtlGetVersion((PRTL_OSVERSIONINFOW)&NtVerInfo)))
     2788    if (   fEarly
     2789        || !NT_SUCCESS(RtlGetVersion((PRTL_OSVERSIONINFOW)&NtVerInfo)))
    27862790    {
    27872791        RT_ZERO(NtVerInfo);
     
    27892793        NtVerInfo.dwMajorVersion = pPeb->OSMajorVersion;
    27902794        NtVerInfo.dwMinorVersion = pPeb->OSMinorVersion;
    2791         NtVerInfo.dwBuildNumber  = pPeb->OSPlatformId;
     2795        NtVerInfo.dwBuildNumber  = pPeb->OSBuildNumber;
    27922796    }
    27932797
  • trunk/src/VBox/HostDrivers/Support/win/SUPLib-win.cpp

    r57358 r59810  
    9393    {
    9494#if defined(VBOX_WITH_HARDENING) && !defined(IN_SUP_HARDENED_R3) && !defined(IN_SUP_R3_STATIC)
    95         supR3HardenedWinInitVersion();
     95        supR3HardenedWinInitVersion(false /*fEarly*/);
    9696        int rc = supHardenedWinInitImageVerifier(NULL);
    9797        if (RT_FAILURE(rc))
  • trunk/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp

    r58730 r59810  
    54805480     * SUPHardenedVerfiyImage-win.cpp.)
    54815481     */
    5482     supR3HardenedWinInitVersion();
     5482    supR3HardenedWinInitVersion(false /*fEarly*/);
    54835483    g_enmSupR3HardenedMainState = SUPR3HARDENEDMAINSTATE_WIN_VERSION_INITIALIZED;
    54845484
     
    57045704     * Init g_uNtVerCombined as well as we can at this point.
    57055705     */
    5706     supR3HardenedWinInitVersion();
     5706    supR3HardenedWinInitVersion(true /*fEarly*/);
    57075707
    57085708    /*
     
    57195719    char **papszArgs = suplibCommandLineToArgvWStub(CmdLineStr.Buffer, CmdLineStr.Length / sizeof(WCHAR), &cArgs);
    57205720    supR3HardenedOpenLog(&cArgs, papszArgs);
    5721     SUP_DPRINTF(("supR3HardenedVmProcessInit: uNtDllAddr=%p\n", uNtDllAddr));
     5721    SUP_DPRINTF(("supR3HardenedVmProcessInit: uNtDllAddr=%p g_uNtVerCombined=%#x\n", uNtDllAddr, g_uNtVerCombined));
    57225722
    57235723    /*
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