[PATCH 15/17] s390/execmem: Add EXECMEM_KPROBES range
From: Heiko Carstens
Date: Thu Dec 03 2026 - 05:34:37 EST
Add an EXECMEM_KPROBES range with PAGE_KERNEL_ROX protection, so that
execmem_alloc(EXECMEM_KPROBES, ...) returns ROX memory. This makes the
s390 specific alloc_insn_page(), which calls set_memory_rox(),
obsolete. Remove it in favor of the generic implementation.
Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
---
arch/s390/kernel/kprobes.c | 16 ----------------
arch/s390/mm/init.c | 7 +++++++
2 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 9bfff628c9bf..d97fd3b9e3db 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -21,9 +21,7 @@
#include <linux/slab.h>
#include <linux/hardirq.h>
#include <linux/ftrace.h>
-#include <linux/execmem.h>
#include <asm/text-patching.h>
-#include <asm/set_memory.h>
#include <asm/sections.h>
#include <asm/dis.h>
#include "entry.h"
@@ -33,20 +31,6 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
struct kretprobe_blackpoint kretprobe_blacklist[] = { };
-void *alloc_insn_page(void)
-{
- void *page;
-
- page = execmem_alloc(EXECMEM_KPROBES, PAGE_SIZE);
- if (!page)
- return NULL;
- if (set_memory_rox((unsigned long)page, 1)) {
- execmem_free(page);
- return NULL;
- }
- return page;
-}
-
static void copy_instruction(struct kprobe *p)
{
kprobe_opcode_t insn[MAX_INSN_SIZE];
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index b9fd795cf788..062b2b5325af 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -331,6 +331,13 @@ struct execmem_info __init *execmem_arch_setup(void)
.pgprot = PAGE_KERNEL,
.alignment = MODULE_ALIGN,
},
+ [EXECMEM_KPROBES] = {
+ .flags = EXECMEM_KASAN_SHADOW,
+ .start = start,
+ .end = MODULES_END,
+ .pgprot = PAGE_KERNEL_ROX,
+ .alignment = MODULE_ALIGN,
+ },
},
};
--
2.53.0