BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/3] bpf: Fixes for unwind_goto and unwind_exit
@ 2026-10-20 23:19 Alexei Starovoitov
  2026-10-20 23:19 ` [PATCH bpf-next 1/3] bpf: Make unwind_exit of an exception callback exit in JITs Alexei Starovoitov
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Alexei Starovoitov @ 2026-10-20 23:19 UTC (permalink / raw)
  To: bpf; +Cc: daniel, andrii, eddyz87, memxor, yonghong.song

From: Alexei Starovoitov <ast@kernel.org>

Two fixes for what the bots found in v4 [1] of the series that added
unwind_goto and unwind_exit.

Patch 1. unwind_exit of an exception callback is exit for the verifier, but
JITs looked up the return address. The callback returns from the frame of
the main prog. After freplace or a tail call that's a return to a prog, and
the callback could end up in a pad that wasn't verified with it.
It came with 'unwind_exit of an async or an exception callback is exit' in
v4. For an async callback that's fine: it has a frame of its own.

Patch 2. Offloaded progs with the new insns are rejected.

Patch 3. Tests for patch 1. They fail without it.

[1] https://lore.kernel.org/bpf/20261020181320.1284798-1-alexei.starovoitov@gmail.com/

Alexei Starovoitov (3):
  bpf: Make unwind_exit of an exception callback exit in JITs
  bpf: Reject unwind_goto and unwind_exit in offloaded progs
  selftests/bpf: Test unwind_exit of an exception callback

 arch/arm64/net/bpf_jit_comp.c                 |  2 +-
 arch/x86/net/bpf_jit_comp.c                   |  2 +-
 include/linux/filter.h                        |  4 +++
 kernel/bpf/verifier.c                         |  2 +-
 .../selftests/bpf/prog_tests/unwind_attach.c  | 22 ++++++++++++--
 .../selftests/bpf/progs/unwind_attach.c       | 29 +++++++++++++++++--
 .../selftests/bpf/progs/verifier_unwind.c     | 29 +++++++++++++++++++
 7 files changed, 82 insertions(+), 8 deletions(-)


base-commit: d4bccf4ee7162c5688b53fe8096b046b89c20c11
-- 
2.55.0


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

end of thread, other threads:[~2026-10-21  2:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-20 23:19 [PATCH bpf-next 0/3] bpf: Fixes for unwind_goto and unwind_exit Alexei Starovoitov
2026-10-20 23:19 ` [PATCH bpf-next 1/3] bpf: Make unwind_exit of an exception callback exit in JITs Alexei Starovoitov
2026-10-20 23:19 ` [PATCH bpf-next 2/3] bpf: Reject unwind_goto and unwind_exit in offloaded progs Alexei Starovoitov
2026-10-20 23:43   ` bot+bpf-ci
2026-10-21  0:08     ` Alexei Starovoitov
2026-10-21  2:23       ` Ihor Solodrai
2026-10-20 23:19 ` [PATCH bpf-next 3/3] selftests/bpf: Test unwind_exit of an exception callback Alexei Starovoitov
2026-10-21  0:10 ` [PATCH bpf-next 0/3] bpf: Fixes for unwind_goto and unwind_exit patchwork-bot+netdevbpf

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