Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On macOS M1, pages enforce strict W^X and cannot be write and execute at the same time. #7

Open
Sewer56 opened this issue Nov 25, 2023 · 0 comments

Comments

@Sewer56
Copy link
Member

Sewer56 commented Nov 25, 2023

Related to: Reloaded-Project/Reloaded.Hooks-rs#1

Currently we toggle between R^X and R^W, because this is forced on us by the mach_ APIs. This is not ideal, in a situation like hooks, it's possible we might be toggling code in process of being executed, in which case, we're smoked.

Unfortunately the JIT APIs pthread_jit_write_protect_np only work on memory allocated with mmap, not the mach APIs, and allocating at specific address with mmap is broken on macOS. Well played.

It would be nice to experiment with mapping each custom page twice over, but that's unfortunately not a possibility right now. Without access to one of these machines, I can't test it very well, short of paying some cloud company for access (lol) or hassling someone too much for my liking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant