On 7/12/24 6:07 PM, Alexei Starovoitov wrote:
On Fri, Jul 12, 2024 at 6:50 AM Daniel Borkmann daniel@iogearbox.net wrote:
On 7/11/24 4:00 PM, Puranjay Mohan wrote: [...]
I was able find the root cause of this bug and will send a fix soon!
Unable to handle kernel paging request at virtual address ffff0000c2a80e68
We are running this test on Qemu with '-cpu max', this means 52-bit virtual addresses are being used.
The trampolines generation code has the following two lines:
emit_addr_mov_i64(A64_R(0), (const u64)im, ctx); emit_call((const u64)__bpf_tramp_enter, ctx);
here the address of struct bpf_tramp_image is moved to R0 and passed as an argument to __bpf_tramp_enter().
emit_addr_mov_i64() assumes that the address passed to it is in the vmalloc space and uses at most 48 bits. It sets all the remaining bits to 1.
but struct bpf_tramp_image is allocated using kzalloc() and when 52-bit VAs are used, its address is not guaranteed to be 48-bit, therefore we see this bug, where 0xfff[0]0000c2a80e68 is converted to 0xfff[f]0000c2a80e68 when the trampoline is generated.
The fix would be use emit_a64_mov_i64() for moving this address into R0.
It looks like there is still an issue left. A recent CI run on bpf-next is still hitting the same on arm64:
Base:
https://github.com/kernel-patches/bpf/commits/series/870746%3D%3Ebpf-next/
CI:
https://github.com/kernel-patches/bpf/actions/runs/9905842936/job/27366435436 [...] #89/11 fexit_bpf2bpf/func_replace_global_func:OK #89/12 fexit_bpf2bpf/fentry_to_cgroup_bpf:OK #89/13 fexit_bpf2bpf/func_replace_progmap:OK #89 fexit_bpf2bpf:OK Error: The operation was canceled.
Let's denylist that test again for now?
Agree, done/pushed now.