riscv: kprobes: Fix build error when MMU=n
PATCH 1/1 riscv: kprobes: Fix build error when MMU=n
From: Jisheng Zhang <[email protected]>
lkp reported a randconfig failure:
arch/riscv/kernel/probes/kprobes.c:90:22: error: use of undeclared identifier 'PAGE_KERNEL_READ_EXEC'
We implemented the alloc_insn_page() to allocate PAGE_KERNEL_READ_EXEC page for kprobes insn page for STRICT_MODULE_RWX. But if MMU=n, we should fall back to the generic weak alloc_insn_page() by generic kprobe subsystem.
--- arch/riscv/kernel/probes/kprobes.c | 2 ++ 1 file changed, 2 insertions(+)
arch/riscv/kernel/probes/kprobes.c +2 -0
@@ -84,6 +84,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)return 0 ; } +#ifdef CONFIG_MMU void *alloc_insn_page (void ) { return __vmalloc_node_range(PAGE_SIZE, 1, VMALLOC_START, VMALLOC_END,
@@ -91,6 +92,7 @@ void *alloc_insn_page(void)VM_FLUSH_RESET_PERMS ,NUMA_NO_NODE , __builtin_return_address(0)); } +#endif /* install breakpoint in text */ void __kprobes arch_arm_kprobe (struct kprobe *p)
Signature · 1 line
2.31.0
Palmer Dabbelt
maintainerQuoted 31 lines · On Sat, 08 May 2021 08:43:47 PDT (-0700), [email protected] wrote:
From: Jisheng Zhang <[email protected]>
lkp reported a randconfig failure:
arch/riscv/kernel/probes/kprobes.c:90:22: error: use of undeclared identifier 'PAGE_KERNEL_READ_EXEC'We implemented the
alloc_insn_page()to allocatePAGE_KERNEL_READ_EXECpage for kprobes insn page forSTRICT_MODULE_RWX. But if MMU=n, we should fall back to the generic weakalloc_insn_page()by generic kprobe subsystem.Fixes cdd1b2bd358f ("riscv: kprobes: Implement alloc_insn_page()")Signed-off-by Jisheng Zhang <[email protected]>Reported-by kernel test robot <[email protected]>--- arch/riscv/kernel/probes/kprobes.c | 2 ++ 1 file changed, 2 insertions(+)arch/riscv/kernel/probes/kprobes.c +1
-0@@ -84,6 +84,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)return 0 ; } +#ifdef CONFIG_MMU void *alloc_insn_page (void ) { return __vmalloc_node_range(PAGE_SIZE, 1, VMALLOC_START, VMALLOC_END,
arch/riscv/kernel/probes/kprobes.c void *alloc_insn_page(void) · line 98
Quoted 7 lines
arch/riscv/kernel/probes/kprobes.c +1
-0@@ -91,6 +92,7 @@ void *alloc_insn_page(void)VM_FLUSH_RESET_PERMS ,NUMA_NO_NODE , __builtin_return_address(0)); } +#endif /* install breakpoint in text */ void __kprobes arch_arm_kprobe (struct kprobe *p)
Thanks, this is on fixes.