unbreak emulators/desmume with immutable userland mappings

BSS is immutable so mark it as mutable so that mprotect RWX works.

see: mimmutable(1)
bc009f82ea

reported by Mikolaj Kucharski <mikolaj at kucharski dot name>
tested by stsp@
ok stsp@ and bentley@ (maintainer)
This commit is contained in:
namn 2022-12-13 04:37:09 +00:00
parent 4ceebbb9f9
commit 9ca1a58a51
3 changed files with 21 additions and 2 deletions

View File

@ -3,7 +3,7 @@ USE_WXNEEDED = Yes
COMMENT = Nintendo DS emulator
DISTNAME = desmume-0.9.11
REVISION = 10
REVISION = 11
CATEGORIES = emulators
@ -44,6 +44,7 @@ COMPILER = base-clang ports-gcc
CONFIGURE_STYLE = gnu
FIX_CRLF_FILES = src/MMU_timing.h \
src/path.h \
src/arm_jit.cpp \
src/utils/AsmJit/core/stringbuilder.h
.include <bsd.port.mk>

View File

@ -0,0 +1,18 @@
BSS is immutable so mark it as mutable so that mprotect RWX works
see: mimmutable(1)
https://github.com/google/syzkaller/commit/bc009f82ea71c399f19eef28f115ff5cda7be4ba
Index: src/arm_jit.cpp
--- src/arm_jit.cpp.orig
+++ src/arm_jit.cpp
@@ -198,7 +198,8 @@ static u8 recompile_counts[(1<<26)/16];
// Reduces memory needed for function pointers.
// FIXME win64 needs this too, x86_32 doesn't
-DS_ALIGN(4096) static u8 scratchpad[1<<25];
+DS_ALIGN(4096) static u8 scratchpad[1<<25]
+ __attribute__((section(".openbsd.mutable")));
static u8 *scratchptr;
struct ASMJIT_API StaticCodeGenerator : public Context

View File

@ -3,7 +3,7 @@ From upstream 8454c93fa37ce9f3c8becc7004a2edddba22f3a1.
Index: src/path.h
--- src/path.h.orig
+++ src/path.h
@@ -375,7 +375,7 @@ class PathInfo (public)
@@ -375,7 +375,7 @@ class PathInfo (public)
else if (strchr(strftimeArgs, *p))
{
char tmp[MAX_PATH];