Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH v2 0/2] bpf: reject stack-argument callback subprograms
@ 2026-08-17 20:48 Jérémy Jean
  2026-08-17 20:48 ` [PATCH v2 1/2] " Jérémy Jean
  2026-08-17 20:48 ` [PATCH v2 2/2] selftests/bpf: add callback stack-argument rejection test Jérémy Jean
  0 siblings, 2 replies; 6+ messages in thread
From: Jérémy Jean @ 2026-08-17 20:48 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi, Yonghong Song
  Cc: bpf, linux-kernel, linux-kselftest, Jérémy Jean

Hello,

Thanks for the feedbacks. Here is the v2 that splits the patch into
two commits. I hope I made it correctly.

/Jérémy

---

Helper callbacks enter BPF subprograms through bpf_callback_t, whose
runtime ABI supplies five arguments. BTF validation nevertheless permits
static callback subprograms to declare more than five arguments when JIT
stack arguments are supported.

This lets verifier state for a callback use outgoing stack argument slots
prepared at the helper call site. The helper does not pass those slots. On
x86-64, callback loads of arguments seven and later therefore read the
helper native frame instead of the synthetic values checked by the
verifier.

This series rejects callback subprograms with incoming stack arguments and
adds verifier coverage for the rejection.

Changes v1 -> v2:
- split the verifier fix and selftest into separate patches;
- drop the callback-specific verifier log message and stop matching it in
  the selftest;
- use __clobber_common plus r6 in the selftest.

Jérémy Jean (2):
  bpf: reject stack-argument callback subprograms
  selftests/bpf: add callback stack-argument rejection test

v1: https://lore.kernel.org/bpf/14a7e7c2-36f7-4aa2-9b20-cc54700a9f1b@linux.dev/T/

 kernel/bpf/verifier.c                         |  2 ++
 .../selftests/bpf/progs/verifier_stack_arg.c  | 32 +++++++++++++++++++
 2 files changed, 34 insertions(+)

-- 
2.47.3

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-08-18 15:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-17 20:48 [PATCH v2 0/2] bpf: reject stack-argument callback subprograms Jérémy Jean
2026-08-17 20:48 ` [PATCH v2 1/2] " Jérémy Jean
2026-08-17 21:37   ` bot+bpf-ci
2026-08-18 15:23   ` Yonghong Song
2026-08-17 20:48 ` [PATCH v2 2/2] selftests/bpf: add callback stack-argument rejection test Jérémy Jean
2026-08-17 21:24   ` bot+bpf-ci

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox