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 17, 2021, at 11:54 PM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> 
> On Wed, Nov 17, 2021 at 11:57:12PM +0000, Song Liu wrote:
> 
>> I would agree that __text_poke() is a safer option. But in this case, we 
>> will need the temporary hole to be 2MB in size. Also, we will probably 
>> hold the temporary mapping for longer time (the whole JITing process). 
>> Does this sound reasonable?
> 
> No :-)
> 
> Jit to a buffer, then copy the buffer into the 2M page using 4k aliases.
> IIRC each program is still smaller than a single page, right? So at no
> point do you need more than 2 pages mapped anyway.

JITing to a separate buffer adds complexity to the JIT process, as we 
need to redo some offsets before the copy to match the final location of 
the program. I don't have much experience with the JIT engine, so I am
not very sure how much work it gonna be. 

The BPF program could have up to 1000000 (BPF_COMPLEXITY_LIMIT_INSNS)
instructions (BPF instructions). So it could easily go beyond a few 
pages. Mapping the 2MB page all together should make the logic simpler. 

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