VirtualBox

Changeset 52424 in vbox


Ignore:
Timestamp:
Aug 20, 2014 3:25:37 AM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
95604
Message:

Only VirtualBox.dll has a TrustedError method, so add a flag to advertise it so we don't wast a lot of effort with VBoxHeadless, VBoxSDL and others that doesn't have it.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/sup.h

    r52392 r52424  
    743743 *
    744744 * This is exported as "TrustedError" by the dynamic libraries which contains
    745  * the "real" application binary for which the hardened stub is built.
     745 * the "real" application binary for which the hardened stub is built. The
     746 * hardened main() must specify SUPSECMAIN_FLAGS_TRUSTED_ERROR when calling
     747 * SUPR3HardenedMain.
    746748 *
    747749 * @param   pszWhere        Where the error occurred (function name).
     
    777779DECLHIDDEN(int) SUPR3HardenedMain(const char *pszProgName, uint32_t fFlags, int argc, char **argv, char **envp);
    778780
    779 /** @name SUPR3SecureMain flags.
     781/** @name SUPR3HardenedMain flags.
    780782 * @{ */
    781783/** Don't open the device. (Intended for VirtualBox without -startvm.) */
    782784#define SUPSECMAIN_FLAGS_DONT_OPEN_DEV      RT_BIT_32(0)
     785/** The hardened DLL has a "TrustedError" function (see FNSUPTRUSTEDERROR). */
     786#define SUPSECMAIN_FLAGS_TRUSTED_ERROR      RT_BIT_32(1)
    783787/** @} */
    784788
  • trunk/src/VBox/Frontends/VirtualBox/src/hardenedmain.cpp

    r49892 r52424  
    5757        }
    5858
    59     return SUPR3HardenedMain("VirtualBox", fFlags, argc, argv, envp);
     59    return SUPR3HardenedMain("VirtualBox", fFlags | SUPSECMAIN_FLAGS_TRUSTED_ERROR, argc, argv, envp);
    6060}
    6161
  • trunk/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp

    r52403 r52424  
    135135/** The program name. */
    136136static const char      *g_pszSupLibHardenedProgName;
     137/** The flags passed to SUPR3HardenedMain. */
     138static uint32_t         g_fSupHardenedMain;
    137139
    138140#ifdef SUP_HARDENED_SUID
     
    15381540{
    15391541    /*
     1542     * Don't bother if the main() function didn't advertise any TrustedError
     1543     * export.  It's both a waste of time and may trigger additional problems,
     1544     * confusing or obscuring the original issue.
     1545     */
     1546    if (!(g_fSupHardenedMain & SUPSECMAIN_FLAGS_TRUSTED_ERROR))
     1547        return NULL;
     1548
     1549    /*
    15401550     * Construct the name.
    15411551     */
     
    16461656     */
    16471657    g_pszSupLibHardenedProgName = pszProgName;
     1658    g_fSupHardenedMain          = fFlags;
    16481659    g_SupPreInitData.u32Magic     = SUPPREINITDATA_MAGIC;
    16491660    g_SupPreInitData.Data.hDevice = SUP_HDEVICE_NIL;
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