Changeset 82957 in vbox for trunk/src/VBox/HostDrivers/Support
- Timestamp:
- Feb 3, 2020 1:31:22 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 135963
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/posix/SUPR3HardenedMain-posix.cpp
r76553 r82957 45 45 # include <unistd.h> /* readlink() */ 46 46 # include <stdlib.h> 47 # include <sys/sysctl.h> /* sysctlbyname() */ 47 48 #elif defined(RT_OS_SOLARIS) 48 49 # include <link.h> … … 640 641 DECLHIDDEN(void) supR3HardenedPosixInit(void) 641 642 { 643 int rc; 644 bool fIgnoreFailure = false; 645 646 #ifdef RT_OS_DARWIN 647 /* 648 * Try figure out / guess if we've got hardened runtime here. For now we'll 649 * just ignore patching errors if when hardened runtime is active. 650 */ 651 int (*pfnCsOps)(pid_t, unsigned int, void *, size_t); 652 *(void **)&pfnCsOps = dlsym(RTLD_DEFAULT, "csops"); 653 if (!pfnCsOps) 654 supR3HardenedFatalMsg("supR3HardenedPosixInit", kSupInitOp_Integrity, VERR_SYMBOL_NOT_FOUND, 655 "Failed locate the 'csops' function"); 656 657 uint32_t fFlags = 0; 658 rc = pfnCsOps(getpid(), 0 /*CS_OPS_STATUS*/, &fFlags, sizeof(fFlags)); 659 # if 0 660 char szMsg[128]; 661 write(2, szMsg, sprintf(szMsg,"DEBUG: p_csflags=%#x rc=%d\n", fFlags, rc)); 662 # endif 663 if (rc != 0) 664 supR3HardenedFatalMsg("supR3HardenedPosixInit", kSupInitOp_Integrity, VERR_GENERAL_FAILURE, 665 "csops/CS_OPS_STATUS failed (%d)", rc); 666 fIgnoreFailure = RT_BOOL(fFlags & 0x00010000 /*CS_RUNTIME*/); 667 #endif 668 642 669 for (unsigned i = 0; i < RT_ELEMENTS(g_aHooks); i++) 643 670 { 644 671 PCSUPHARDENEDPOSIXHOOK pHook = &g_aHooks[i]; 645 intrc = supR3HardenedMainPosixHookOne(pHook->pszSymbol, pHook->pfnHook, pHook->ppfnRealResume, pHook->pfnResolve);646 if (RT_FAILURE(rc) )672 rc = supR3HardenedMainPosixHookOne(pHook->pszSymbol, pHook->pfnHook, pHook->ppfnRealResume, pHook->pfnResolve); 673 if (RT_FAILURE(rc) && !fIgnoreFailure) 647 674 supR3HardenedFatalMsg("supR3HardenedPosixInit", kSupInitOp_Integrity, rc, 648 675 "Failed to hook the %s interface", pHook->pszSymbol);
Note:
See TracChangeset
for help on using the changeset viewer.