Re: [PATCH bpf-next 2/7] set_memory: introduce set_memory_[ro|x]_noalias

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

 




> On Nov 16, 2021, at 12:00 AM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> 
> On Mon, Nov 15, 2021 at 11:13:42PM -0800, Song Liu wrote:
>> These allow setting ro/x for module_alloc() mapping, while leave the
>> linear mapping rw/nx.
> 
> This needs a very strong rationale for *why*. How does this not
> trivially circumvent W^X ?

In this case, we want to have multiple BPF programs sharing the 2MB page. 
When the JIT engine is working on one program, we would rather existing
BPF programs on the same page stay on RO+X mapping (the module_alloc() 
address). The solution in this version is to let the JIT engine write to 
the page via linear address. 

An alternative is to only use the module_alloc() address, and flip the 
read-only bit (of the whole 2MB page) back and forth. However, this 
requires some serialization among different JIT jobs. 

Johannes also noticed that set_memory_[ro|x] for kernel modules and BPF 
programs causes splitting the 1GB linear mapping. This leads to visible 
performance degradation in the tests. CC'ing him for more details on this. 

Thanks,
Song



[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