Song Liu <song@xxxxxxxxxx> writes: > Instead of blindly allocating PAGE_SIZE for each trampoline, check the size > of the trampoline with arch_bpf_trampoline_size(). This size is saved in > bpf_tramp_image->size, and used for modmem charge/uncharge. The fallback > arch_alloc_bpf_trampoline() still allocates a whole page because we need to > use set_memory_* to protect the memory. > > struct_ops trampoline still uses a whole page for multiple trampolines. > > With this size check at caller (regular trampoline and struct_ops > trampoline), remove arch_bpf_trampoline_size() from > arch_prepare_bpf_trampoline() in archs. > > Also, update bpf_image_ksym_add() to handle symbol of different sizes. > > Signed-off-by: Song Liu <song@xxxxxxxxxx> > Acked-by: Ilya Leoshkevich <iii@xxxxxxxxxxxxx> > Tested-by: Ilya Leoshkevich <iii@xxxxxxxxxxxxx> # on s390x (And this one got stuck on my queue...) Acked-by: Björn Töpel <bjorn@xxxxxxxxxxxx> Tested-by: Björn Töpel <bjorn@xxxxxxxxxxxx> # on riscv