Using mprotect to make text segment writable on macOS
问题 This is essentially what I'm trying to do, #include <sys/mman.h> int zero() { return 0; } int main(int argc, const char *argv[]) { return mprotect((void *) &zero, 4096, PROT_READ | PROT_WRITE); } so I'm trying to make code writable, essentially. This doesn't work on the current macOS (Catalina 10.15.2), it just returns -1 and sets errno to EACCES , which as far as I know is because of lack of entitlement/code signing. I've found the entitlement I need to set, but I have no idea how to go