on iko/ghcjs-patch-master help sign in
patch out calls to mprotect with len=0 to stop qemu 6.0.0 from signalling ENOMEM (#1289)
aaf4e23Ross MacLeod
overlays/bootstrap.nix+1
@@ -164,6 +164,7 @@ in {
164 ++ final.lib.optional (versionAtLeast "8.10.3" && final.targetPlatform.isAarch64) ./patches/ghc/3434.patch
164 ++ final.lib.optional (versionAtLeast "8.10.3" && final.targetPlatform.isAarch64) ./patches/ghc/3434.patch
165
165
166 ++ from "8.10.1" ./patches/ghc/ghc-acrt-iob-func.patch
166 ++ from "8.10.1" ./patches/ghc/ghc-acrt-iob-func.patch
167+ ++ from "8.10.1" ./patches/ghc/ghc-mprotect-nonzero-len.patch
167
168
168 ++ fromUntil "8.10.1" "8.10.3" ./patches/ghc/ghc-8.10-ubxt.patch
169 ++ fromUntil "8.10.1" "8.10.3" ./patches/ghc/ghc-8.10-ubxt.patch
169 ++ fromUntil "8.10.3" "8.10.5" ./patches/ghc/ghc-8.10.3-ubxt.patch
170 ++ fromUntil "8.10.3" "8.10.5" ./patches/ghc/ghc-8.10.3-ubxt.patch
overlays/patches/ghc/ghc-mprotect-nonzero-len.patchnew file+14
@@ -0,0 +1,14 @@
1+diff --git a/rts/Linker.c b/rts/Linker.c
2+index f1c0db7c92..10b0764b38 100644
3+--- a/rts/Linker.c
4++++ b/rts/Linker.c
5+@@ -1161,6 +1161,9 @@ void mmapForLinkerMarkExecutable(void *start, size_t len)
6+ IF_DEBUG(linker,
7+ debugBelch("mmapForLinkerMarkExecutable: protecting %" FMT_Word
8+ " bytes starting at %p\n", (W_)len, start));
9++ if (len == 0) {
10++ return;
11++ }
12+ if (mprotect(start, len, PROT_READ|PROT_EXEC) == -1) {
13+ barf("mmapForLinkerMarkExecutable: mprotect: %s\n", strerror(errno));
14+ }