BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next v3 0/2] bpf: Allow void return type for global subprogs
@ 2026-02-23 21:50 Emil Tsalapatis
  2026-02-23 21:50 ` [PATCH bpf-next v3 1/2] bpf: Allow void global functions in the verifier Emil Tsalapatis
  2026-02-23 21:50 ` [PATCH bpf-next v3 2/2] selftests: bpf: Add tests for void global subprogs Emil Tsalapatis
  0 siblings, 2 replies; 10+ messages in thread
From: Emil Tsalapatis @ 2026-02-23 21:50 UTC (permalink / raw)
  To: bpf
  Cc: andrii, ast, daniel, eddyz87, martin.lau, memxor, song,
	yonghong.song, Emil Tsalapatis

Global subprogs are currently not allowed to return void. Adjust
verifier logic to allow global functions with a void return type.
Exception callbacks are excluded from this change, and still require
a scalar return type.

Also adjust existing selftests that were ensuring that global subprogs
with void return types fail to verify. These tests should now load
successfully.

v2 -> v3
(https://lore.kernel.org/bpf/20260210183257.217285-1-emil@etsalapatis.com/)
- Allow freplace for global programs that return void and add selftests (Kumar)

v1 -> v2
(https://lore.kernel.org/bpf/20260127231414.359283-1-emil@etsalapatis.com/)

- Only mark R0 as valid for non-void global functions (AI)
- Rename subprog_is_void to subprog_returns_void (Kumar)
- Add test that R0 is invalid after calling a void global (Alexei)
- Add check to ensure exception callbacks do not return void
and associated selftest

Cc: Kumar Kartikeya Dwivedi <memxor@gmail.com>

Emil Tsalapatis (2):
  bpf: Allow void global functions in the verifier
  selftests: bpf: Add tests for void global subprogs

 kernel/bpf/btf.c                              |  7 ++-
 kernel/bpf/verifier.c                         | 59 +++++++++++++++++--
 .../selftests/bpf/prog_tests/fexit_bpf2bpf.c  | 24 ++++++++
 .../bpf/prog_tests/test_global_funcs.c        |  2 +
 .../selftests/bpf/progs/exceptions_fail.c     | 19 +++++-
 .../bpf/progs/freplace_int_with_void.c        | 14 +++++
 .../selftests/bpf/progs/freplace_void.c       | 14 +++++
 .../selftests/bpf/progs/test_global_func18.c  | 23 ++++++++
 .../selftests/bpf/progs/test_global_func7.c   |  2 +-
 9 files changed, 151 insertions(+), 13 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/freplace_int_with_void.c
 create mode 100644 tools/testing/selftests/bpf/progs/freplace_void.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_global_func18.c

-- 
2.49.0


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

end of thread, other threads:[~2026-02-25  0:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23 21:50 [PATCH bpf-next v3 0/2] bpf: Allow void return type for global subprogs Emil Tsalapatis
2026-02-23 21:50 ` [PATCH bpf-next v3 1/2] bpf: Allow void global functions in the verifier Emil Tsalapatis
2026-02-24  0:09   ` Eduard Zingerman
2026-02-24 18:46     ` Emil Tsalapatis
2026-02-24 19:02       ` Eduard Zingerman
2026-02-24 19:53         ` Emil Tsalapatis
2026-02-24 20:33           ` Eduard Zingerman
2026-02-25  0:55             ` Emil Tsalapatis
2026-02-23 21:50 ` [PATCH bpf-next v3 2/2] selftests: bpf: Add tests for void global subprogs Emil Tsalapatis
2026-02-24  0:24   ` Eduard Zingerman

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