VirtualBox

Changeset 51978 in vbox for trunk/src


Ignore:
Timestamp:
Jul 11, 2014 2:57:40 AM (11 years ago)
Author:
vboxsync
Message:

Need to initialize the SUPR3HardenedVerify* bits in the extension pack manager too, so split it (the init code) out into a separate API.

Location:
trunk/src/VBox
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPLib.cpp

    r51770 r51978  
    14671467
    14681468
     1469SUPR3DECL(int) SUPR3HardenedVerifyInit(void)
     1470{
     1471#ifdef RT_OS_WINDOWS
     1472    if (g_cInits == 0)
     1473        return suplibOsHardenedVerifyInit();
     1474#endif
     1475    return VINF_SUCCESS;
     1476}
     1477
     1478
     1479SUPR3DECL(int) SUPR3HardenedVerifyTerm(void)
     1480{
     1481#ifdef RT_OS_WINDOWS
     1482    if (g_cInits == 0)
     1483        return suplibOsHardenedVerifyTerm();
     1484#endif
     1485    return VINF_SUCCESS;
     1486}
     1487
     1488
    14691489SUPR3DECL(int) SUPR3HardenedVerifyFile(const char *pszFilename, const char *pszMsg, PRTFILE phFile)
    14701490{
  • trunk/src/VBox/HostDrivers/Support/SUPLibInternal.h

    r51909 r51978  
    334334int     suplibOsInit(PSUPLIBDATA pThis, bool fPreInited, bool fUnrestricted);
    335335int     suplibOsTerm(PSUPLIBDATA pThis);
     336int     suplibOsHardenedVerifyInit(void);
     337int     suplibOsHardenedVerifyTerm(void);
    336338int     suplibOsIOCtl(PSUPLIBDATA pThis, uintptr_t uFunction, void *pvReq, size_t cbReq);
    337339int     suplibOsIOCtlFast(PSUPLIBDATA pThis, uintptr_t uFunction, uintptr_t idCpu);
  • trunk/src/VBox/HostDrivers/Support/win/SUPLib-win.cpp

    r51970 r51978  
    8080#endif
    8181
     82/*******************************************************************************
     83*   Global Variables                                                           *
     84*******************************************************************************/
     85static bool g_fHardenedVerifyInited = false;
     86
     87
     88int suplibOsHardenedVerifyInit(void)
     89{
     90    if (!g_fHardenedVerifyInited)
     91    {
     92#if defined(VBOX_WITH_HARDENING) && !defined(IN_SUP_HARDENED_R3) && !defined(IN_SUP_R3_STATIC)
     93        supR3HardenedWinInitVersion();
     94        int rc = supHardenedWinInitImageVerifier(NULL);
     95        if (RT_FAILURE(rc))
     96            return rc;
     97        supR3HardenedWinResolveVerifyTrustApiAndHookThreadCreation();
     98#endif
     99        g_fHardenedVerifyInited = true;
     100    }
     101    return VINF_SUCCESS;
     102}
     103
     104
     105int suplibOsHardenedVerifyTerm(void)
     106{
     107    /** @todo free resources...  */
     108    return VINF_SUCCESS;
     109}
     110
    82111
    83112int suplibOsInit(PSUPLIBDATA pThis, bool fPreInited, bool fUnrestricted)
     
    86115     * Make sure the image verifier is fully initialized.
    87116     */
    88 #if defined(VBOX_WITH_HARDENING) && !defined(IN_SUP_HARDENED_R3) && !defined(IN_SUP_R3_STATIC)
    89     supR3HardenedWinInitVersion();
    90     int rc = supHardenedWinInitImageVerifier(NULL);
     117    int rc = suplibOsHardenedVerifyInit();
    91118    if (RT_FAILURE(rc))
    92119        return rc;
    93     supR3HardenedWinResolveVerifyTrustApiAndHookThreadCreation();
    94 #endif
    95120
    96121    /*
     
    199224}
    200225
     226
    201227#ifndef IN_SUP_HARDENED_R3
    202228
  • trunk/src/VBox/Main/src-all/ExtPackManagerImpl.cpp

    r51687 r51978  
    716716    m->enmContext                   = a_enmContext;
    717717    m->fMadeReadyCall               = false;
     718
     719    /*
     720     * Make sure the SUPR3Hardened API works (ignoring errors for now).
     721     */
     722    int rc = SUPR3HardenedVerifyInit();
     723    if (RT_FAILURE(rc))
     724        LogRel(("SUPR3HardenedVerifyInit failed: %Rrc\n", rc));
    718725
    719726    /*
  • trunk/src/VBox/Main/src-helper-apps/VBoxExtPackHelperApp.cpp

    r51971 r51978  
    17871787        return RTMsgInitFailure(rc);
    17881788
    1789 #ifdef RT_OS_WINDOWS
    1790     SUPR3InitEx(false /*fUnrestricted*/, NULL); /* Ignore return code, we only need the image verifier bits to work. */
    1791 #endif
     1789    SUPR3HardenedVerifyInit();
    17921790    RTERRINFOSTATIC ErrInfo;
    17931791    RTErrInfoInitStatic(&ErrInfo);
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