On 2024-05-17 17:46, Will Deacon wrote:
Hi Klara,
On Fri, May 17, 2024 at 01:00:31AM +0200, Klara Modin wrote:
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 <klarasmodin@xxxxxxxxx>