VirtualBox

Changeset 23131 in vbox for trunk/src


Ignore:
Timestamp:
Sep 18, 2009 1:47:24 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4-OSX: try to fix Leopard on hardened builds

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/main.cpp

    r22823 r23131  
    162162# include <sys/mman.h>
    163163# include <iprt/asm.h>
     164# include <iprt/system.h>
    164165
    165166/** Really ugly hack to shut up a silly check in AppKit. */
    166167static void ShutUpAppKit(void)
    167168{
    168     /*
    169      * Find issetguid() and make it always return 0 by modifying the code.
    170      */
    171     void *addr = dlsym(RTLD_DEFAULT, "issetugid");
    172     int rc = mprotect((void *)((uintptr_t)addr & ~(uintptr_t)0xfff), 0x2000, PROT_WRITE|PROT_READ|PROT_EXEC);
    173     if (!rc)
    174         ASMAtomicWriteU32((volatile uint32_t *)addr, 0xccc3c031); /* xor eax, eax; ret; int3 */
     169    /* Check for Snow Leopard or higher */
     170    char pszInfo[64];
     171    int rc = RTSystemQueryOSInfo (RTSYSOSINFO_RELEASE, pszInfo, sizeof(pszInfo));
     172    if (RT_SUCCESS (rc) &&
     173        pszInfo[0] == 1) /* higher than 1x.x.x */
     174    {
     175        /*
     176         * Find issetguid() and make it always return 0 by modifying the code.
     177         */
     178        void *addr = dlsym(RTLD_DEFAULT, "issetugid");
     179        int rc = mprotect((void *)((uintptr_t)addr & ~(uintptr_t)0xfff), 0x2000, PROT_WRITE|PROT_READ|PROT_EXEC);
     180        if (!rc)
     181            ASMAtomicWriteU32((volatile uint32_t *)addr, 0xccc3c031); /* xor eax, eax; ret; int3 */
     182    }
    175183}
    176184#endif /* DARWIN */
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