jart / blink

tiniest x86-64-linux emulator
ISC License
7.01k stars 225 forks source link

mprotecting a page with RWX on macOS fails #13

Closed Dadoum closed 1 year ago

Dadoum commented 1 year ago

macOS forbids RWX pages, and to circumvent this limitation I wanted to see if blink could have RWX pages (Read+Write+Execute). But here is what happens:

I2022-12-27T15:04:32.097045:blink/memorymalloc.c:612:87752 mprotect(0x100080600000 [0x188880600000], 0x4000, 7) failed

Anyway, thanks for your awesome work!

Dadoum commented 1 year ago

Note: Putting prot &= ~PROT_EXEC; before protecting seems to work.

jart commented 1 year ago

Your recommendation sounds like the right thing to do here. I'm going to push a fix. Let us know if it doesn't address the issue for you!