Le 18/11/2022 à 10:39, Hari Bathini a écrit : > > > On 18/11/22 2:21 pm, Christophe Leroy wrote: >>>>> >>>>> I had the same config but hit this problem: >>>>> >>>>> # echo 1 > /proc/sys/net/core/bpf_jit_enable; modprobe test_bpf >>>>> test_bpf: #0 TAX >>>>> ------------[ cut here ]------------ >>>>> WARNING: CPU: 0 PID: 96 at arch/powerpc/net/bpf_jit_comp.c:367 >>>>> bpf_int_jit_compile+0x8a0/0x9f8 >>>> >>>> I get no such problem, on QEMU, and I checked the .config has: >>> >>>> CONFIG_STRICT_KERNEL_RWX=y >>>> CONFIG_STRICT_MODULE_RWX=y >>> >>> Yeah. That did the trick. >> >> Interesting. I guess we have to find out why it fails when those config >> are missing. >> >> Maybe module code plays with RO and NX flags even if >> CONFIG_STRICT_MODULE_RWX is not selected ? > > Need to look at the code closely but fwiw, observing same failure on > 64-bit as well with !STRICT_RWX... The problem is in bpf_prog_pack_alloc() and in alloc_new_pack() : They do set_memory_ro() and set_memory_x() without taking into account CONFIG_STRICT_MODULE_RWX. When CONFIG_STRICT_MODULE_RWX is selected, powerpc module_alloc() allocates PAGE_KERNEL memory, that is RW memory, and expects the user to call do set_memory_ro() and set_memory_x(). But when CONFIG_STRICT_MODULE_RWX is not selected, powerpc module_alloc() allocates PAGE_KERNEL_TEXT memory, that is RWX memory, and expects to be able to always write into it. Christophe