VirtualBox

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


Ignore:
Timestamp:
Apr 20, 2017 2:43:46 PM (8 years ago)
Author:
vboxsync
Message:

HostDrivers/Support: Allow following symlinks on Linux for libraries loaded through dlopen()

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

Legend:

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

    r66526 r66632  
    449449DECLHIDDEN(int)     supR3HardenedVerifyFile(const char *pszFilename, RTHCUINTPTR hNativeFile, bool fMaybe3rdParty,
    450450                                            PRTERRINFO pErrInfo);
    451 #ifdef RT_OS_DARWIN
     451#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX)
    452452DECLHIDDEN(int)     supR3HardenedVerifyFileFollowSymlinks(const char *pszFilename, RTHCUINTPTR hNativeFile, bool fMaybe3rdParty,
    453453                                                          PRTERRINFO pErrInfo);
  • trunk/src/VBox/HostDrivers/Support/SUPR3HardenedVerify.cpp

    r66627 r66632  
    10361036}
    10371037
    1038 #ifdef RT_OS_DARWIN
     1038
     1039#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX)
    10391040/**
    10401041 * Copies the four messages into the error buffer and returns @a rc.
     
    10531054    return supR3HardenedSetErrorN(rc, pErrInfo, 4, pszMsg1, pszMsg2, pszMsg3, pszMsg4);
    10541055}
    1055 #endif /* RT_OS_DARWIN */
     1056#endif
    10561057
    10571058
     
    10721073}
    10731074
     1075
    10741076#ifdef SOME_UNUSED_FUNCTION
    1075 
    10761077/**
    10771078 * Copies the two messages into the error buffer and returns @a rc.
     
    10881089    return supR3HardenedSetErrorN(rc, pErrInfo, 2, pszMsg1, pszMsg2);
    10891090}
    1090 
    1091 #endif /* SOME_UNUSED_FUNCTION */
    1092 
    1093 #ifdef RT_OS_DARWIN
    1094 
     1091#endif
     1092
     1093
     1094#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX)
    10951095/**
    10961096 * Copies the error message to the error buffer and returns @a rc.
     
    11051105    return supR3HardenedSetErrorN(rc, pErrInfo, 1, pszMsg);
    11061106}
    1107 
    11081107#endif
    11091108
     
    15011500    /*
    15021501     * World must not have write access.  There is no relaxing this rule.
    1503      */
    1504     if (pFsObjState->Stat.st_mode & S_IWOTH)
     1502     * Linux exception: Symbolic links are always give permission 0777, there
     1503     *                  is no lchmod or lchown APIs.  The permissions on parent
     1504     *                  directory that contains the symbolic link is what is
     1505     *                  decising wrt to modifying it.  (Caller is expected not
     1506     *                  to allow symbolic links in the first path component.)
     1507     */
     1508    if (   (pFsObjState->Stat.st_mode & S_IWOTH)
     1509# ifdef RT_OS_LINUX
     1510        && (   !S_ISLNK(pFsObjState->Stat.st_mode)
     1511            || !fSymlinksAllowed /* paranoia */)
     1512# endif
     1513       )
    15051514        return supR3HardenedSetError3(VERR_SUPLIB_WORLD_WRITABLE, pErrInfo,
    15061515                                      "World writable: '", pszPath, "'");
     
    18461855
    18471856
    1848 #ifdef RT_OS_DARWIN
     1857#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX)
    18491858/**
    18501859 * Verfies a file following symlinks.
     
    20012010    return VINF_SUCCESS;
    20022011}
    2003 #endif /* RT_OS_DARWIN */
     2012#endif /* RT_OS_DARWIN || RT_OS_LINUX */
    20042013
    20052014
  • trunk/src/VBox/HostDrivers/Support/posix/SUPR3HardenedMain-posix.cpp

    r66605 r66632  
    190190        && strchr(pszFilename, '/') != NULL)
    191191    {
    192 #ifdef RT_OS_DARWIN
     192#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX)
    193193        int rc = supR3HardenedVerifyFileFollowSymlinks(pszFilename, RTHCUINTPTR_MAX, true /* fMaybe3rdParty */,
    194194                                                       NULL /* pErrInfo */);
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