Changeset 56817 in vbox for trunk/src/VBox/HostDrivers/Support
- Timestamp:
- Jul 6, 2015 1:20:19 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 101468
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPLibInternal.h
r56746 r56817 440 440 441 441 442 DECLHIDDEN(int) supR3HardenedVerifyAll(bool fFatal, const char *pszProgName, const char *pszExePath );442 DECLHIDDEN(int) supR3HardenedVerifyAll(bool fFatal, const char *pszProgName, const char *pszExePath, uint32_t fMainFlags); 443 443 DECLHIDDEN(int) supR3HardenedVerifyFixedDir(SUPINSTDIR enmDir, bool fFatal); 444 444 DECLHIDDEN(int) supR3HardenedVerifyFixedFile(const char *pszFilename, bool fFatal); -
trunk/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp
r56746 r56817 1910 1910 SUP_DPRINTF(("SUPR3HardenedMain: Respawn #1\n")); 1911 1911 supR3HardenedWinInit(SUPSECMAIN_FLAGS_DONT_OPEN_DEV, false /*fAvastKludge*/); 1912 supR3HardenedVerifyAll(true /* fFatal */, pszProgName, g_szSupLibHardenedExePath );1912 supR3HardenedVerifyAll(true /* fFatal */, pszProgName, g_szSupLibHardenedExePath, fFlags); 1913 1913 return supR3HardenedWinReSpawn(1 /*iWhich*/); 1914 1914 } … … 1927 1927 * Validate the installation. 1928 1928 */ 1929 supR3HardenedVerifyAll(true /* fFatal */, pszProgName, g_szSupLibHardenedExePath );1929 supR3HardenedVerifyAll(true /* fFatal */, pszProgName, g_szSupLibHardenedExePath, fFlags); 1930 1930 1931 1931 /* -
trunk/src/VBox/HostDrivers/Support/SUPR3HardenedVerify.cpp
r56733 r56817 189 189 { kSupIFT_Exe, kSupID_AppBin, true, "VirtualBox" SUPLIB_EXE_SUFF }, 190 190 { 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 191 194 # if !defined(RT_OS_DARWIN) && !defined(RT_OS_WINDOWS) && !defined(RT_OS_OS2) 192 195 { kSupIFT_Dll, kSupID_AppSharedLib, true, "VBoxKeyboard" SUPLIB_DLL_SUFF }, … … 853 856 * @param fLeaveOpen The leave open setting used by 854 857 * supR3HardenedVerifyAll. 855 */ 856 static int supR3HardenedVerifyProgram(const char *pszProgName, const char *pszExePath, bool fFatal, bool fLeaveOpen) 858 * @param fMainFlags Flags supplied to SUPR3HardenedMain. 859 */ 860 static int supR3HardenedVerifyProgram(const char *pszProgName, const char *pszExePath, bool fFatal, 861 bool fLeaveOpen, uint32_t fMainFlags) 857 862 { 858 863 /* 859 864 * 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. 860 868 */ 861 869 int rc = VINF_SUCCESS; 862 870 bool fExe = false; 863 871 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 865 883 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)) 867 885 { 868 if ( 869 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)) 871 889 { 872 890 /* This only has to be found (once). */ … … 881 899 else if ( ( g_aSupInstallFiles[iFile].enmType == kSupIFT_Exe 882 900 || 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)) 884 904 { 885 905 /* Here we'll have to check that the specific program is the same as the entry. */ … … 927 947 * DLL/DYLIB/SO are valid. 928 948 * @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 */ 951 DECLHIDDEN(int) supR3HardenedVerifyAll(bool fFatal, const char *pszProgName, const char *pszExePath, uint32_t fMainFlags) 931 952 { 932 953 /* … … 955 976 * sign things. 956 977 */ 957 int rc2 = supR3HardenedVerifyProgram(pszProgName, pszExePath, fFatal, fLeaveOpen );978 int rc2 = supR3HardenedVerifyProgram(pszProgName, pszExePath, fFatal, fLeaveOpen, fMainFlags); 958 979 if (RT_FAILURE(rc2) && RT_SUCCESS(rc)) 959 980 rc2 = rc;
Note:
See TracChangeset
for help on using the changeset viewer.