Skip to content

Commit 02ccdee

Browse files
xhackerustcpalmer-dabbelt
authored andcommitted
riscv: kprobes: Fix build error when MMU=n
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. Fixes: cdd1b2b ("riscv: kprobes: Implement alloc_insn_page()") Signed-off-by: Jisheng Zhang <[email protected]> Reported-by: kernel test robot <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 97a0310 commit 02ccdee

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/riscv/kernel/probes/kprobes.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,15 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
8484
return 0;
8585
}
8686

87+
#ifdef CONFIG_MMU
8788
void *alloc_insn_page(void)
8889
{
8990
return __vmalloc_node_range(PAGE_SIZE, 1, VMALLOC_START, VMALLOC_END,
9091
GFP_KERNEL, PAGE_KERNEL_READ_EXEC,
9192
VM_FLUSH_RESET_PERMS, NUMA_NO_NODE,
9293
__builtin_return_address(0));
9394
}
95+
#endif
9496

9597
/* install breakpoint in text */
9698
void __kprobes arch_arm_kprobe(struct kprobe *p)

0 commit comments

Comments
 (0)