Skip to content

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

@Sewer56

Description

@Sewer56

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions