VirtualBox

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


Ignore:
Timestamp:
Apr 10, 2024 12:26:37 AM (8 months ago)
Author:
vboxsync
Message:

SUP: Moved the program binary directory check to the right place, replace weird strncmp use with suplibHardenedStrCmp, and make it applicable to all hosts defining RTPATH_APP_PRIVATE_ARCH and therefore expecting the binaries to be installed in a certain location. bugref:10626

File:
1 edited

Legend:

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

    r104166 r104261  
    13441344    suplibHardenedStrCopy(g_szSupLibHardenedAppBinPath, g_szSupLibHardenedExePath);
    13451345    suplibHardenedPathStripFilename(g_szSupLibHardenedAppBinPath);
    1346 
    1347     /* Make sure binary is located in known location (unix-like hosts only). */
    1348 #if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD) || defined(RT_OS_SOLARIS) || defined(RT_OS_DARWIN)
    1349     if (strncmp(RTPATH_APP_PRIVATE_ARCH, g_szSupLibHardenedAppBinPath, sizeof(RTPATH_APP_PRIVATE_ARCH)) != 0)
    1350         supR3HardenedFatal("supR3HardenedExecDir: refusing to start binary from unknown location %s\n",
    1351                            g_szSupLibHardenedAppBinPath);
    1352 #endif
    13531346
    13541347    g_offSupLibHardenedExecName = suplibHardenedStrLen(g_szSupLibHardenedAppBinPath);
     
    14061399            supR3HardenedFatal("supR3HardenedExecDir: Unknown program binary location: %#x\n", g_fSupHardenedMain);
    14071400    }
     1401
     1402#ifdef RTPATH_APP_PRIVATE_ARCH
     1403    /*
     1404     * If the location is fixed, do not continue if it is not correct. Binaries
     1405     * must not be allowed to be started from anywhere else.  (@bugref{10626})
     1406     */
     1407    if (suplibHardenedStrCmp(g_szSupLibHardenedAppBinPath, RTPATH_APP_PRIVATE_ARCH) != 0)
     1408        supR3HardenedFatal("supR3HardenedExecDir: Invalid program binary location: %s (expected %s)\n",
     1409                           g_szSupLibHardenedAppBinPath, RTPATH_APP_PRIVATE_ARCH);
     1410# ifdef RT_OS_WINDOWS
     1411#  error "Didn't expect RTPATH_APP_PRIVATE_ARCH to be defined on Windows."
     1412# endif
     1413#elif defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD) || defined(RT_OS_SOLARIS) || defined(RT_OS_DARWIN)
     1414# error "Expected RTPATH_APP_PRIVATE_ARCH to be define on this host."
     1415#endif
    14081416}
    14091417
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