linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] riscv: kprobes: Fix build error when MMU=n
@ 2021-05-08 15:43 Jisheng Zhang
  2021-05-23  5:07 ` Palmer Dabbelt
  0 siblings, 1 reply; 2+ messages in thread
From: Jisheng Zhang @ 2021-05-08 15:43 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou; +Cc: linux-riscv, linux-kernel

From: Jisheng Zhang <jszhang@kernel.org>

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: cdd1b2bd358f ("riscv: kprobes: Implement alloc_insn_page()")
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Reported-by: kernel test robot <lkp@intel.com>
---
 arch/riscv/kernel/probes/kprobes.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/riscv/kernel/probes/kprobes.c b/arch/riscv/kernel/probes/kprobes.c
index 10b965c34536..15cc65ac7ca6 100644
--- a/arch/riscv/kernel/probes/kprobes.c
+++ b/arch/riscv/kernel/probes/kprobes.c
@@ -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)
-- 
2.31.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] riscv: kprobes: Fix build error when MMU=n
  2021-05-08 15:43 [PATCH] riscv: kprobes: Fix build error when MMU=n Jisheng Zhang
@ 2021-05-23  5:07 ` Palmer Dabbelt
  0 siblings, 0 replies; 2+ messages in thread
From: Palmer Dabbelt @ 2021-05-23  5:07 UTC (permalink / raw)
  To: jszhang3; +Cc: Paul Walmsley, aou, linux-riscv, linux-kernel

On Sat, 08 May 2021 08:43:47 PDT (-0700), jszhang3@mail.ustc.edu.cn wrote:
> From: Jisheng Zhang <jszhang@kernel.org>
>
> 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: cdd1b2bd358f ("riscv: kprobes: Implement alloc_insn_page()")
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> Reported-by: kernel test robot <lkp@intel.com>
> ---
>  arch/riscv/kernel/probes/kprobes.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/riscv/kernel/probes/kprobes.c b/arch/riscv/kernel/probes/kprobes.c
> index 10b965c34536..15cc65ac7ca6 100644
> --- a/arch/riscv/kernel/probes/kprobes.c
> +++ b/arch/riscv/kernel/probes/kprobes.c
> @@ -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)

Thanks, this is on fixes.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-23  5:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-08 15:43 [PATCH] riscv: kprobes: Fix build error when MMU=n Jisheng Zhang
2021-05-23  5:07 ` Palmer Dabbelt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).