Open Hpmason opened 1 year ago
Since MacOS Catalina, the linker makes the __TEXT
segment read-only (r-x
). It's possible to work around it by patching the Mach-O maxprot
field. Unfortunately I don't think there's anything you can do to fix this within the bounds of this library.
You can try it out yourself like this:
cargo test
to build the test binary (the tests should fail)maxprot
field of the test binary: printf '\x07' | dd of=./target/debug/deps/retour-*whatever* bs=1 seek=160 count=1 conv=notrunc
./target/debug/deps/retour-*whatever*
(the tests should pass)Funnily enough, the issue also goes away when a debugger is attached.
Wow, that's annoying. I see that darfink had a python script to fix that issue. We'll probably need to use their script or something similar to get it working, then.
Most of the MacOS unit tests fail due to a permission error in CI:
Requires more testing outside of CI, but I don't have my Macbook on hand atm to fix.