rentzsch / mach_star

code injection and function overriding for Mac OS X
254 stars 46 forks source link

32bit Intel on MacOSX 10.7 - vm_protect(..., VM_PROT_EXECUTE | VM_PROT_WRITE | VM_PROT_READ) needed #13

Closed albertz closed 13 years ago

albertz commented 13 years ago

In some cases (e.g. Valve Steam; 32bit Intel), I got this error/crash:

17.09.11 18:48:16,000 kernel: Data/Stack execution not permitted: steam[pid 87117] at virtual address 0x1779000, protections were read-write

In mach_inject.c:mach_inject(), there is this code:

#if defined(__x86_64__)
    err = vm_protect(remoteTask, remoteCode, imageSize, 0, VM_PROT_EXECUTE | VM_PROT_WRITE | VM_PROT_READ); 
#endif

I wonder why this is only enabled for 64bit. If I also use the same code for 32bit, I can successfully inject into Valve Steam.

rentzsch commented 13 years ago

I think Rajiv Eranki was just being conservative when he upgraded mach_inject to x86-64. Toss me a pull request and I'll merge it.

rentzsch commented 13 years ago

Pulled, thanks!