From 200240f328349f8c1ddcd3f7ef76abff32131911 Mon Sep 17 00:00:00 2001 From: plutoo Date: Sat, 20 Jan 2018 19:36:18 +0100 Subject: [PATCH] Actually reprotect code segment to RX --- nx/source/kernel/jit.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nx/source/kernel/jit.c b/nx/source/kernel/jit.c index e38bf9d3..ec523319 100644 --- a/nx/source/kernel/jit.c +++ b/nx/source/kernel/jit.c @@ -103,6 +103,14 @@ Result jitTransitionToExecutable(Jit* j) switch (j->type) { case JitType_CodeMemory: rc = svcMapProcessCodeMemory(envGetOwnProcessHandle(), (u64) j->rx_addr, (u64) j->src_addr, j->size); + + if (R_SUCCEEDED(rc)) { + rc = svcSetProcessMemoryPermission(envGetOwnProcessHandle(), (u64) j->rx_addr, j->size, PERM_RX); + + if (R_FAILED(rc)) { + jitTransitionToWritable(j); + } + } break; case JitType_JitMemory: