There's a change in mprotect() behaviour [1] in the latest macOS on M1 and it's not yet clear if it's going to be fixed by Apple. For now we can avoid unsupported mprotect() calls. QEMU and qtests work fine without it.
1. https://gist.github.com/hikalium/75ae822466ee4da13cbbe486498a191f Buglink: https://bugs.launchpad.net/qemu/+bug/1914849 Apple-Feedback: FB8994773 Signed-off-by: Roman Bolshakov <r.bolsha...@yadro.com> --- util/osdep.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/util/osdep.c b/util/osdep.c index 66d01b9160..1edd7b1caf 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -111,6 +111,12 @@ int qemu_mprotect_none(void *addr, size_t size) #ifdef _WIN32 return qemu_mprotect__osdep(addr, size, PAGE_NOACCESS); #else +# if defined(__APPLE__) && defined(__arm64__) + if (__builtin_available(macOS 11.2, *)) { + /* mprotect() in macOS 11.2 can't switch RWX to NONE */ + return 0; + } +# endif return qemu_mprotect__osdep(addr, size, PROT_NONE); #endif } -- 2.30.0