VirtualBox

Ignore:
Timestamp:
Jul 6, 2015 1:20:19 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
101468
Message:

Attempt at fixing VirtualBoxVM (untested).

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

Legend:

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

    r56746 r56817  
    440440
    441441
    442 DECLHIDDEN(int)     supR3HardenedVerifyAll(bool fFatal, const char *pszProgName, const char *pszExePath);
     442DECLHIDDEN(int)     supR3HardenedVerifyAll(bool fFatal, const char *pszProgName, const char *pszExePath, uint32_t fMainFlags);
    443443DECLHIDDEN(int)     supR3HardenedVerifyFixedDir(SUPINSTDIR enmDir, bool fFatal);
    444444DECLHIDDEN(int)     supR3HardenedVerifyFixedFile(const char *pszFilename, bool fFatal);
  • trunk/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp

    r56746 r56817  
    19101910        SUP_DPRINTF(("SUPR3HardenedMain: Respawn #1\n"));
    19111911        supR3HardenedWinInit(SUPSECMAIN_FLAGS_DONT_OPEN_DEV, false /*fAvastKludge*/);
    1912         supR3HardenedVerifyAll(true /* fFatal */, pszProgName, g_szSupLibHardenedExePath);
     1912        supR3HardenedVerifyAll(true /* fFatal */, pszProgName, g_szSupLibHardenedExePath, fFlags);
    19131913        return supR3HardenedWinReSpawn(1 /*iWhich*/);
    19141914    }
     
    19271927     * Validate the installation.
    19281928     */
    1929     supR3HardenedVerifyAll(true /* fFatal */, pszProgName, g_szSupLibHardenedExePath);
     1929    supR3HardenedVerifyAll(true /* fFatal */, pszProgName, g_szSupLibHardenedExePath, fFlags);
    19301930
    19311931    /*
  • trunk/src/VBox/HostDrivers/Support/SUPR3HardenedVerify.cpp

    r56733 r56817  
    189189    {   kSupIFT_Exe,  kSupID_AppBin,             true, "VirtualBox" SUPLIB_EXE_SUFF },
    190190    {   kSupIFT_Dll,  kSupID_AppPrivArch,        true, "VirtualBox" SUPLIB_DLL_SUFF },
     191# ifdef RT_OS_DARWIN
     192    {   kSupIFT_Exe,  kSupID_AppBin,             true, "VirtualBoxVM" SUPLIB_EXE_SUFF },
     193# endif
    191194# if !defined(RT_OS_DARWIN) && !defined(RT_OS_WINDOWS) && !defined(RT_OS_OS2)
    192195    {   kSupIFT_Dll,  kSupID_AppSharedLib,       true, "VBoxKeyboard" SUPLIB_DLL_SUFF },
     
    853856 * @param   fLeaveOpen          The leave open setting used by
    854857 *                              supR3HardenedVerifyAll.
    855  */
    856 static int supR3HardenedVerifyProgram(const char *pszProgName, const char *pszExePath, bool fFatal, bool fLeaveOpen)
     858 * @param   fMainFlags          Flags supplied to SUPR3HardenedMain.
     859 */
     860static int supR3HardenedVerifyProgram(const char *pszProgName, const char *pszExePath, bool fFatal,
     861                                      bool fLeaveOpen, uint32_t fMainFlags)
    857862{
    858863    /*
    859864     * Search the table looking for the executable and the DLL/DYLIB/SO.
     865     * Note! On darwin we have a hack in place for VirtualBoxVM helper app
     866     *       to share VirtualBox.dylib with the VirtualBox app.  This ASSUMES
     867     *       that cchProgNameDll is equal or shorter to the exe name.
    860868     */
    861869    int             rc = VINF_SUCCESS;
    862870    bool            fExe = false;
    863871    bool            fDll = false;
    864     size_t const    cchProgName = suplibHardenedStrLen(pszProgName);
     872    size_t const    cchProgNameExe = suplibHardenedStrLen(pszProgName);
     873#ifndef RT_OS_DARWIN
     874    size_t const    cchProgNameDll = cchProgNameExe;
     875#else
     876    size_t const    cchProgNameDll = fMainFlags & SUPSECMAIN_FLAGS_OSX_VM_APP
     877                                   ? sizeof("VirtualBox") - 1
     878                                   : cchProgNameExe;
     879    if (cchProgNameDll > cchProgNameExe)
     880        return supR3HardenedError(VERR_INTERNAL_ERROR, fFatal,
     881                                  "supR3HardenedVerifyProgram: SUPSECMAIN_FLAGS_OSX_VM_APP + '%s'", pszProgName);
     882#endif
    865883    for (unsigned iFile = 0; iFile < RT_ELEMENTS(g_aSupInstallFiles); iFile++)
    866         if (!suplibHardenedStrNCmp(pszProgName, g_aSupInstallFiles[iFile].pszFile, cchProgName))
     884        if (!suplibHardenedStrNCmp(pszProgName, g_aSupInstallFiles[iFile].pszFile, cchProgNameDll))
    867885        {
    868             if (    (   g_aSupInstallFiles[iFile].enmType == kSupIFT_Dll
    869                      || g_aSupInstallFiles[iFile].enmType == kSupIFT_TestDll)
    870                 &&  !suplibHardenedStrCmp(&g_aSupInstallFiles[iFile].pszFile[cchProgName], SUPLIB_DLL_SUFF))
     886            if (   (   g_aSupInstallFiles[iFile].enmType == kSupIFT_Dll
     887                    || g_aSupInstallFiles[iFile].enmType == kSupIFT_TestDll)
     888                && !suplibHardenedStrCmp(&g_aSupInstallFiles[iFile].pszFile[cchProgNameDll], SUPLIB_DLL_SUFF))
    871889            {
    872890                /* This only has to be found (once). */
     
    881899            else if (   (   g_aSupInstallFiles[iFile].enmType == kSupIFT_Exe
    882900                         || g_aSupInstallFiles[iFile].enmType == kSupIFT_TestExe)
    883                      && !suplibHardenedStrCmp(&g_aSupInstallFiles[iFile].pszFile[cchProgName], SUPLIB_EXE_SUFF))
     901                     && (   cchProgNameExe == cchProgNameDll
     902                         || !suplibHardenedStrNCmp(pszProgName, g_aSupInstallFiles[iFile].pszFile, cchProgNameExe))
     903                     && !suplibHardenedStrCmp(&g_aSupInstallFiles[iFile].pszFile[cchProgNameExe], SUPLIB_EXE_SUFF))
    884904            {
    885905                /* Here we'll have to check that the specific program is the same as the entry. */
     
    927947 *                              DLL/DYLIB/SO are valid.
    928948 * @param   pszExePath          The path to the executable.
    929  */
    930 DECLHIDDEN(int) supR3HardenedVerifyAll(bool fFatal, const char *pszProgName, const char *pszExePath)
     949 * @param   fMainFlags          Flags supplied to SUPR3HardenedMain.
     950 */
     951DECLHIDDEN(int) supR3HardenedVerifyAll(bool fFatal, const char *pszProgName, const char *pszExePath, uint32_t fMainFlags)
    931952{
    932953    /*
     
    955976     * sign things.
    956977     */
    957     int rc2 = supR3HardenedVerifyProgram(pszProgName, pszExePath, fFatal, fLeaveOpen);
     978    int rc2 = supR3HardenedVerifyProgram(pszProgName, pszExePath, fFatal, fLeaveOpen, fMainFlags);
    958979    if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
    959980        rc2 = rc;
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