BPF List
 help / color / mirror / Atom feed
* [PATCH v1 bpf-next 0/5] Do not tag selected functions as fmodret targets
@ 2026-11-25 21:28 Anton Protopopov
  2026-11-25 21:28 ` [PATCH v1 bpf-next 1/5] resolve_btfids: Do not tag functions which work on BPF objects Anton Protopopov
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Anton Protopopov @ 2026-11-25 21:28 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi, Jiri Olsa,
	Alan Maguire, John Fastabend, bpf
  Cc: Anton Protopopov

With CONFIG_BPF_FMODRET_SCAN=y the build tags the functions that
return errors, so that an fmod_ret program can attach to them. Among
them are functions which BPF itself relies on: the verifier, the
trampolines, kfuncs and helpers. As was suggested by Alexei in [1],
we shouldn't tag such functions.

Changes split into a few logcal pieces:

  * Patch 1 excludes the functions which use BPF types.
  * Patch 2 excludes kfuncs and helpers.
  * Patch 3 adds a static list of functions to exclude,
    which contains only 3 functions for now.
  * Patch 4 excludes the code of kernel/bpf/* and of JITs (x86 and arm).
  * Patch 5 adds a corresponding selftest.

In my arm64 vmlinux build this removes 774 tags, 13650 are left.
Precisely,

  * Patch 1, BPF types:        removes 575 targets
  * Patch 2, kfuncs, helpers:  removes another 130 targets
  * Patch 3, by name:          removes another 2 targets
  * Patch 4, kernel/bpf, JITs: removes another 67 targets

One implementation note: the llvm-nm was chosen to list names in Patch 4,
because a) it handles any object independently of how the kernel is built
b) BPF scan already requires llvm tools.

  [1] https://lore.kernel.org/bpf/DN3P7509U44I.MLLYA1W3M3X9@gmail.com/

Anton Protopopov (5):
  resolve_btfids: Do not tag functions which work on BPF objects
  resolve_btfids: Do not tag kfuncs and helpers
  resolve_btfids: Exclude a set of functions by name
  resolve_btfids: Exclude the code of kernel/bpf and of the JIT
  selftests/bpf: Test functions which must have no fmod_ret tag

 tools/bpf/resolve_btfids/Makefile             |   1 +
 tools/bpf/resolve_btfids/fmodret.c            | 164 +++++++++++++++++-
 tools/bpf/resolve_btfids/llvm-mc.sh           |   8 +-
 .../bpf/prog_tests/fmodret_untagged.c         |  61 +++++++
 4 files changed, 231 insertions(+), 3 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/fmodret_untagged.c

-- 
2.43.0


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

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

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 21:28 [PATCH v1 bpf-next 0/5] Do not tag selected functions as fmodret targets Anton Protopopov
2026-11-25 21:28 ` [PATCH v1 bpf-next 1/5] resolve_btfids: Do not tag functions which work on BPF objects Anton Protopopov
2026-11-25 21:25   ` sashiko-bot
2026-11-26 10:50     ` Anton Protopopov
2026-11-25 22:14   ` bot+bpf-ci
2026-11-26 10:49     ` Anton Protopopov
2026-11-25 21:28 ` [PATCH v1 bpf-next 2/5] resolve_btfids: Do not tag kfuncs and helpers Anton Protopopov
2026-11-25 21:28 ` [PATCH v1 bpf-next 3/5] resolve_btfids: Exclude a set of functions by name Anton Protopopov
2026-11-25 21:57   ` bot+bpf-ci
2026-11-26  0:55   ` Alexei Starovoitov
2026-11-26  0:56   ` Alexei Starovoitov
2026-11-26 11:29     ` Anton Protopopov
2026-11-25 21:28 ` [PATCH v1 bpf-next 4/5] resolve_btfids: Exclude the code of kernel/bpf and of the JIT Anton Protopopov
2026-11-25 22:15   ` bot+bpf-ci
2026-11-26  0:53   ` Alexei Starovoitov
2026-11-26 13:18     ` Anton Protopopov
2026-11-25 21:28 ` [PATCH v1 bpf-next 5/5] selftests/bpf: Test functions which must have no fmod_ret tag Anton Protopopov

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