[PATCH bpf-next 0/2] Reject callback subprogs invoke tailcall

Pu Lehui posted 2 patches 2 weeks ago
There is a newer version of this series
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
[PATCH bpf-next 0/2] Reject callback subprogs invoke tailcall
Posted by Pu Lehui 2 weeks ago
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