Skip to content

[WIP] MacOS Support #50

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

[WIP] MacOS Support #50

wants to merge 4 commits into from

Conversation

gsquire
Copy link

@gsquire gsquire commented Jun 13, 2025

This is a work in progress for #43.

I tried to add MacOS support via this patch but have been dealing with what I believe to be hardened runtime restrictions. I'm developing on an M2 chip. I get SIGBUS errors when the library tries to copy the generated ASM into the memory-mapped region. I am posting this in hopes that someone with more experience can comment on whether or not I am on the right path at least. Below are some links to documentation I read through.

@mazong1123
Copy link
Collaborator

@gsquire thanks for starting this work! It's really appreciated! I don't have a mac environment to check. But I'd like to learn from other people helping here.

@gsquire
Copy link
Author

gsquire commented Jun 18, 2025

I had some time to work on this today so I wanted to update the thread.

I ran one of the test binaries through LLDB and found out that the error I'm seeing is an invalid memory fetch:

Process 59306 stopped
* thread #2, name = 'test_will_return_boolean_when_fake_complex_generic_function_mul', stop reason = EXC_BAD_ACCESS (code=2, address=0x1000011d8)
    frame #0: 0x000000018f5783f8 libsystem_platform.dylib`_platform_memmove + 424
libsystem_platform.dylib`_platform_memmove:
->  0x18f5783f8 <+424>: str    x6, [x3], #0x8
    0x18f5783fc <+428>: subs   x2, x2, #0x8
    0x18f578400 <+432>: b.hs   0x18f5783f4    ; <+420>
    0x18f578404 <+436>: adds   x2, x2, #0x8

(lldb) register read
General Purpose Registers:
        x0 = 0x00000001000011d8  will_return-824334915c6e7ea9`will_return::complex_generic_multiple_types_func_return_false::h69c6a7f7c5db2f2d at will_return.rs:11
        x1 = 0x00000001700064d0
        x2 = 0x0000000000000004
        x3 = 0x00000001000011d8  will_return-824334915c6e7ea9`will_return::complex_generic_multiple_types_func_return_false::h69c6a7f7c5db2f2d at will_return.rs:11
        x4 = 0x000000000000000c
        x5 = 0x0000000000000002
        x6 = 0xd503201f14073b8a
        x7 = 0x0000000000000000
        x8 = 0x0000000000000001
        x9 = 0x000000000000000c
       x10 = 0x000000000000000c
       x11 = 0x0000000000000001
       x12 = 0x0000000000000000
       x13 = 0x0000000000000000
       x14 = 0x000000008042a7fb
       x15 = 0x0000000080229ffb
       x16 = 0x000000018f578250  libsystem_platform.dylib`_platform_memmove
       x17 = 0x0000600003920000
       x18 = 0x0000000000000000
       x19 = 0x0000000170006ce8
       x20 = 0x000000003b9aca00
       x21 = 0x0000000000000000
       x22 = 0x0000000000000000
       x23 = 0x000000003b9aca00
       x24 = 0x0000000000000001
       x25 = 0x000000003b9aca00
       x26 = 0x0000000000000000
       x27 = 0x00000001000bcf19  will_return-824334915c6e7ea9`__rust_no_alloc_shim_is_unstable
       x28 = 0x0000000170006cd0
        fp = 0x0000000170006300
        lr = 0x000000010003c000  will_return-824334915c6e7ea9`injectorpp::injector_core::common::inject_asm_code::he062c9898b486fba + 156 at common.rs:283:5
        sp = 0x00000001700061c0
        pc = 0x000000018f5783f8  libsystem_platform.dylib`_platform_memmove + 424
      cpsr = 0x20001000

(lldb) memory read $x6
error: memory read failed for 0x201f14073a00

I'm still looking into why this is.

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

Successfully merging this pull request may close these issues.

2 participants