Re: [RFC PATCH 0/3] enable bpf_prog_pack allocator for powerpc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux