]> git.ipfire.org Git - thirdparty/linux.git/commit
bpf,x86: adjust the "jmp" mode for bpf trampoline
authorMenglong Dong <menglong8.dong@gmail.com>
Tue, 18 Nov 2025 12:36:32 +0000 (20:36 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 24 Nov 2025 17:47:03 +0000 (09:47 -0800)
commit373f2f44c300815c5f170e89560ac361c0053dfe
tree3dad2f2bbdf4514eb78fcdafc781e03a2674183b
parent47c9214dcbea9043ac20441a285c7bb5486b8b2d
bpf,x86: adjust the "jmp" mode for bpf trampoline

In the origin call case, if BPF_TRAMP_F_SKIP_FRAME is not set, it means
that the trampoline is not called, but "jmp".

Introduce the function bpf_trampoline_use_jmp() to check if the trampoline
is in "jmp" mode.

Do some adjustment on the "jmp" mode for the x86_64. The main adjustment
that we make is for the stack parameter passing case, as the stack
alignment logic changes in the "jmp" mode without the "rip". What's more,
the location of the parameters on the stack also changes.

Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
Link: https://lore.kernel.org/r/20251118123639.688444-5-dongml2@chinatelecom.cn
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
arch/x86/net/bpf_jit_comp.c
include/linux/bpf.h