Re: [PATCH bpf-next v3 3/9] bpf, x86: JIT __arena kfunc argument rebasing
Eduard Zingerman <[email protected]> Tue, 04 Aug 2026 17:40:56 -0700
| Newsgroups | org.kernel.vger.bpf |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 2026-08-03 at 14:51 +0200, Kumar Kartikeya Dwivedi wrote: > From: Tejun Heo <[email protected]> > > Implement arena argument rebasing for kfunc calls on x86. R12 already > holds kern_vm_start whenever the prog has an arena, so each tagged > argument costs two instructions emitted right before the call: > > movl %eN, %eN /* truncate, clear the upper 32 bits */ > addq %r12, %rN > > A nullable argument tests the truncated value and jumps over the add: > > movl %eN, %eN > testl %eN, %eN > jz 1f > addq %r12, %rN > 1: > > addq carries a REX prefix for every argument register and is always > three bytes, so the jz displacement is constant. The sequence is native > code generated after constant blinding has run on the BPF instruction > stream, so blinding never sees the rebase and needs no special handling. > > bpf_jit_supports_arena_args() is not flipped yet; that happens when the > struct_ops trampoline side is in place as well. > > Signed-off-by: Tejun Heo <[email protected]> > Signed-off-by: Kumar Kartikeya Dwivedi <[email protected]> > --- Acked-by: Eduard Zingerman <[email protected]> ...