BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] Reject callback subprogs invoke tailcall
@ 2026-07-11 10:47 Pu Lehui
  2026-07-11 10:47 ` [PATCH bpf-next 1/2] bpf: " Pu Lehui
  2026-07-11 10:47 ` [PATCH bpf-next 2/2] selftests/bpf: Add testcases for callback with tailcall Pu Lehui
  0 siblings, 2 replies; 6+ messages in thread
From: Pu Lehui @ 2026-07-11 10:47 UTC (permalink / raw)
  To: bpf, linux-kernel, Björn Töpel, Daniel Borkmann
  Cc: Alexei Starovoitov, Andrii Nakryiko, Eduard Zingerman,
	Kumar Kartikeya Dwivedi, Yonghong Song, Martin KaFai Lau,
	John Fastabend, Song Liu, Jiri Olsa, Emil Tsalapatis, Pu Lehui,
	Pu Lehui

Some JIT compilers, such as x86_64, rely on a register to pass the TCC.
When subprograms of synchronous callback invoke tailcall, C helpers
invoking bpf callback clobber this register, and the corrupted TCC may
bypass the TCC limit, leading to infinite tailcall.

Fix this by rejecting tailcall inside all subprogs of sync callback.
This also cleanly consolidates the existing async and exception callback
checks into a single unified `is_cb` check.

Pu Lehui (2):
  bpf: Reject callback subprogs invoke tailcall
  selftests/bpf: Add testcases for callback with tailcall

 kernel/bpf/verifier.c                         |   8 +-
 .../selftests/bpf/prog_tests/tailcalls.c      |   7 +
 .../selftests/bpf/progs/tailcall_callback.c   | 129 ++++++++++++++++++
 3 files changed, 138 insertions(+), 6 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/tailcall_callback.c

-- 
2.34.1


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

end of thread, other threads:[~2026-07-11 11:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-11 10:47 [PATCH bpf-next 0/2] Reject callback subprogs invoke tailcall Pu Lehui
2026-07-11 10:47 ` [PATCH bpf-next 1/2] bpf: " Pu Lehui
2026-07-11 10:57   ` sashiko-bot
2026-07-11 11:33   ` bot+bpf-ci
2026-07-11 10:47 ` [PATCH bpf-next 2/2] selftests/bpf: Add testcases for callback with tailcall Pu Lehui
2026-07-11 10:54   ` sashiko-bot

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