From: Yonghong Song <yonghong.song@linux.dev>
To: bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Eduard Zingerman <eddyz87@gmail.com>,
kernel-team@fb.com
Subject: [PATCH bpf-next 0/5] bpf: Follow up by-value struct and __int128 argument support
Date: Thu, 8 Oct 2026 23:42:06 -0700 [thread overview]
Message-ID: <20261009064206.1238047-1-yonghong.song@linux.dev> (raw)
This is a follow-up to the series "bpf: Support by-value struct and
__int128 arguments" [1], which placed kfunc arguments by the kernel
calling convention in the x86-64 and arm64 JITs, and made the arm64
trampoline place an argument aligned to 16 bytes: an __int128, or an
aggregate holding one. This series covers what was left:
- The x86-64 trampoline. x86-64 starts such an argument passed on the
stack at a 16-byte aligned slot, which can leave an empty slot
before it, but the trampoline copied the stack arguments as if
there were none. A bpf program attached to such a function read the
wrong values from the empty slot on, and with fexit, where the
trampoline calls the traced function itself, that function got its
stack arguments one slot off as well.
- A trampoline on a BPF function. BPF code calls one with the
arguments in the BPF convention, one slot after another, but the
arm64 trampoline placed them by the kernel convention, and the
x86-64 fix above would have done the same.
- Tests with an __int128 at an odd slot, where arm64 leaves a register
or a stack slot empty. On arm64 such a kfunc gets BTF only with the
pahole patch [2], now in pahole master after v1.32, so these tests
were not part of [1].
Patch 1 adds the odd-slot kfunc tests. Patch 2 keeps a BPF function's
trampoline arguments in the BPF convention, and patch 3 places the
x86-64 trampoline arguments by the calling convention. Patches 4 and 5
test trampolines on kernel functions and on BPF functions with an
argument after a 16-byte aligned one.
Tested on x86-64 with test_progs.
[1] https://lore.kernel.org/bpf/20260912195156.980886-1-yonghong.song@linux.dev/
[2] https://lore.kernel.org/dwarves/20260917164043.1577508-1-yonghong.song@linux.dev/
Yonghong Song (5):
selftests/bpf: Test by-value __int128 kfunc arguments at an odd slot
bpf: Keep the BPF calling convention for a trampoline on a BPF
function
bpf, x86: Place trampoline arguments by the x86-64 calling convention
selftests/bpf: Test trampoline args around a 16-byte aligned stack arg
selftests/bpf: Test trampoline args of a BPF function at an odd slot
arch/x86/net/bpf_jit_comp.c | 189 +++++++++---------
include/linux/bpf.h | 2 +
kernel/bpf/btf.c | 1 +
kernel/bpf/core.c | 12 ++
kernel/bpf/verifier.c | 1 +
.../selftests/bpf/prog_tests/tracing_struct.c | 96 ++++++++-
.../selftests/bpf/progs/aggregate_arg_kfunc.c | 71 +++++++
.../bpf/progs/tracing_struct_int128.c | 45 +++++
.../bpf/progs/tracing_struct_int128_tgt.c | 68 +++++++
.../bpf/progs/tracing_struct_int128_tracer.c | 44 ++++
.../selftests/bpf/test_kmods/bpf_testmod.c | 69 +++++++
.../bpf/test_kmods/bpf_testmod_kfunc.h | 13 ++
12 files changed, 515 insertions(+), 96 deletions(-)
create mode 100644 tools/testing/selftests/bpf/progs/tracing_struct_int128_tgt.c
create mode 100644 tools/testing/selftests/bpf/progs/tracing_struct_int128_tracer.c
--
2.53.0-Meta
next reply other threads:[~2026-10-09 6:42 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 6:42 Yonghong Song [this message]
2026-10-09 6:42 ` [PATCH bpf-next 1/5] selftests/bpf: Test by-value __int128 kfunc arguments at an odd slot Yonghong Song
2026-10-09 7:48 ` bot+bpf-ci
2026-10-09 17:04 ` Yonghong Song
2026-10-09 6:42 ` [PATCH bpf-next 2/5] bpf: Keep the BPF calling convention for a trampoline on a BPF function Yonghong Song
2026-10-09 7:26 ` bot+bpf-ci
2026-10-09 17:20 ` Yonghong Song
2026-10-10 15:00 ` Alexei Starovoitov
2026-10-12 6:03 ` Yonghong Song
2026-10-09 6:42 ` [PATCH bpf-next 3/5] bpf, x86: Place trampoline arguments by the x86-64 calling convention Yonghong Song
2026-10-09 7:08 ` sashiko-bot
2026-10-09 17:38 ` Yonghong Song
2026-10-09 6:42 ` [PATCH bpf-next 4/5] selftests/bpf: Test trampoline args around a 16-byte aligned stack arg Yonghong Song
2026-10-09 6:51 ` sashiko-bot
2026-10-09 18:12 ` Yonghong Song
2026-10-09 6:42 ` [PATCH bpf-next 5/5] selftests/bpf: Test trampoline args of a BPF function at an odd slot Yonghong Song
2026-10-09 7:48 ` bot+bpf-ci
2026-10-09 18:17 ` Yonghong Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261009064206.1238047-1-yonghong.song@linux.dev \
--to=yonghong.song@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=kernel-team@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox