Thread (23 messages) 23 messages, 5 authors, 2024-05-17

Re: [PATCH RESEND v8 16/16] bpf: remove CONFIG_BPF_JIT dependency on CONFIG_MODULES of

From: Klara Modin <hidden>
Date: 2024-05-17 16:09:47
Also in: bpf, linux-arch, linux-arm-kernel, linux-mips, linux-mm, linux-modules, linux-riscv, linux-s390, linux-trace-kernel, lkml, loongarch, netdev, sparclinux

On 2024-05-17 17:46, Will Deacon wrote:
quoted hunk ↗ jump to hunk
Hi Klara,

On Fri, May 17, 2024 at 01:00:31AM +0200, Klara Modin wrote:
quoted
This does not seem to work entirely. If build with BPF_JIT without module
support for my Raspberry Pi 3 B I get warnings in my kernel log (easiest way
to trigger it seems to be trying to ssh into it, which fails).
Thanks for the report. I was able to reproduce this using QEMU and it
looks like the problem is because bpf_arch_text_copy() silently fails
to write to the read-only area as a result of patch_map() faulting and
the resulting -EFAULT being chucked away.

Please can you try the diff below?

Will

--->8
diff --git a/arch/arm64/kernel/patching.c b/arch/arm64/kernel/patching.c
index 255534930368..94b9fea65aca 100644
--- a/arch/arm64/kernel/patching.c
+++ b/arch/arm64/kernel/patching.c
@@ -36,7 +36,7 @@ static void __kprobes *patch_map(void *addr, int fixmap)
  
         if (image)
                 page = phys_to_page(__pa_symbol(addr));
-       else if (IS_ENABLED(CONFIG_STRICT_MODULE_RWX))
+       else if (IS_ENABLED(CONFIG_EXECMEM))
                 page = vmalloc_to_page(addr);
         else
                 return addr;
This seems to work from my short testing.

Thanks,
Tested-by: Klara Modin <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help