libffcall
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #66089] On macos mprotect can't be PROT_WRITE and PROT_EXEC at


From: Lorenzo Daneo
Subject: Re: [bug #66089] On macos mprotect can't be PROT_WRITE and PROT_EXEC at the same time
Date: Wed, 14 Aug 2024 20:09:45 +0200

Sadly I can't print an understandable stack trace with libbacktrace.
This is what I see:
trampoline: cannot make memory executable
Received signal 6:
Frame: signal_handler (CTest/callback.c:27)
Frame: (null) ((null):0)
Frame: (null) ((null):0)
Frame: (null) ((null):0)
Frame: (null) ((null):0)
Frame: (null) ((null):0)
Frame: alloc_void_call_void (CTest/callback.c:73)
Frame: create_deck (/Users/lorenzodaneo/Projects/MyTests/CTest/deck.c:15)
Frame: init_game (/Users/lorenzodaneo/Projects/MyTests/CTest/game.c:12)
Frame: main (CTest/main.c:14)

From xcode it seems be better:
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x0000000197786a60 libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x000000010074abe8 libsystem_pthread.dylib`pthread_kill + 288
    frame #2: 0x00000001976cba30 libsystem_c.dylib`abort + 180
  * frame #3: 0x00000001004c3428 libffcall.0.dylib`callback_trampoline_alloc.cold.2 at trampoline.c:1292:72 [opt]
    frame #4: 0x00000001004c061c libffcall.0.dylib`callback_trampoline_alloc(address=(libffcall.0.dylib`callback_receiver), data0=0x0000000100002eb4, data1=0x0000600002b980c0) at trampoline.c:1292:17 [opt]
    frame #5: 0x0000000100002ea8 CTest`alloc_void_call_void(the_this=0x0000000153705290, the_func=0x000000010000386c) at callback.c:73:12
    frame #6: 0x0000000100002a5c CTest`create_deck at deck.c:15:27
    frame #7: 0x0000000100002694 CTest`init_game(n_players='\x02') at game.c:12:18
    frame #8: 0x0000000100002640 CTest`main(argc=1, argv=0x000000016fdff528) at main.c:14:20
    frame #9: 0x00000001974360e0 dyld`start + 2360

Hope this help.

Thank you,
Lorenzo

Il giorno mer 14 ago 2024 alle ore 19:25 Lorenzo Daneo <lorenzo.daneo91@gmail.com> ha scritto:
Also, in attachment you can find the file I changed.

Lorenzo

Il giorno mer 14 ago 2024 alle ore 19:22 Lorenzo Daneo <lorenzo.daneo91@gmail.com> ha scritto:
Hello Bruno,

I'm using version 2.4 of libffcal compiled locally with HAVE_MPROTECT_AFTER_MMAP_CAN_EXEC set to 1.
I don't know why, but the installation with brew was going in error at line 87 in trampoline.c, so I suspected I had to pass something to brew as a parameter, but I couldn't find it was that variable until I tried to compile the library locally.
Anyway, I'm on MacOS Sonoma 14.5 with an Apple Silicon M2 chip.

Is the CI running on an Intel chip? I read somewhere that this behaviour (PROT_WRITE and PROT_EXEC not usable together) is only on Apple Silicon.

I'm trying to extract the stacktrace as you asked.

Best regards,
Lorenzo


Il giorno mer 14 ago 2024 alle ore 19:08 Bruno Haible <INVALID.NOREPLY@gnu.org> ha scritto:
Follow-up Comment #2, bug #66089 (group libffcall):

Also:

Which version of libffcall are you using?

What exactly is the scenario (test program) that causes the SIGABRT on macOS?

I'm asking because my continuous integration of libffcall shows no problems on
macOS versions 12, 13, 14: https://github.com/gnu-libffcall/ci-check/actions


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?66089>

{savane: Include the next line when replying by email.}
{savane: user = 362990; tracker = bugs; item = 66089}

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]