Changeset 59409 in vbox for trunk/src/VBox/Frontends/VBoxHeadless
- Timestamp:
- Jan 19, 2016 1:37:10 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 105119
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
r55867 r59409 44 44 45 45 #ifdef VBOX_WITH_VPX 46 #include <cstdlib> 47 #include <cerrno> 48 #include <iprt/process.h> 46 # include <cstdlib> 47 # include <cerrno> 48 # include <iprt/process.h> 49 #endif 50 51 #ifdef RT_OS_DARWIN 52 # include <dlfcn.h> 53 # include <sys/mman.h> 49 54 #endif 50 55 … … 586 591 static CComModule _Module; 587 592 #endif 593 594 #ifdef RT_OS_DARWIN 595 /** 596 * Mac OS X: Really ugly hack to bypass a set-uid check in AppKit. 597 * 598 * This will modify the issetugid() function to always return zero. This must 599 * be done _before_ AppKit is initialized, otherwise it will refuse to play ball 600 * with us as it distrusts set-uid processes since Snow Leopard. We, however, 601 * have carefully dropped all root privileges at this point and there should be 602 * no reason for any security concern here. 603 */ 604 static void hideSetUidRootFromAppKit() 605 { 606 /* Find issetguid() and make it always return 0 by modifying the code: */ 607 void *pvAddr = dlsym(RTLD_DEFAULT, "issetugid"); 608 int rc = mprotect((void *)((uintptr_t)pvAddr & ~(uintptr_t)0xfff), 0x2000, PROT_WRITE | PROT_READ | PROT_EXEC); 609 if (!rc) 610 ASMAtomicWriteU32((volatile uint32_t *)pvAddr, 0xccc3c031); /* xor eax, eax; ret; int3 */ 611 } 612 #endif /* RT_OS_DARWIN */ 588 613 589 614 /** … … 685 710 const char *pcszNameOrUUID = NULL; 686 711 712 #ifdef RT_OS_DARWIN 713 hideSetUidRootFromAppKit(); 714 #endif 715 687 716 // parse the command line 688 717 int ch;
Note:
See TracChangeset
for help on using the changeset viewer.