public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next v1 0/3] Add support to emit verifier warnings
@ 2026-03-29 21:25 Kumar Kartikeya Dwivedi
  2026-03-29 21:25 ` [PATCH bpf-next v1 1/3] bpf: Extract bpf_get_linfo_file_line Kumar Kartikeya Dwivedi
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Kumar Kartikeya Dwivedi @ 2026-03-29 21:25 UTC (permalink / raw)
  To: bpf
  Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
	Martin KaFai Lau, Eduard Zingerman, Ihor Solodrai, kkd,
	kernel-team

Currently, there are only two ways of communicating information to the user
when a program is verified, success or failure with a verbose verifier log.
Some information is meant to be more discretionary, e.g. warning about use of
kfuncs that are deprecated, and may be removed in future kernel releases.

For this purpose, we can make use of the program's stderr stream. Until the
program is finished loading and actually attached somewhere, it cannot write to
its own stream. This means that there is a point where all collected verifier
warnings can be flushed and displayed to the user.

An example is shown below.

$ ./test_progs -t kfunc_implicit_args/test_kfunc_implicit_arg_legacy_impl -v
...
libbpf: prog 'test_kfunc_implicit_arg_legacy_impl': VERIFIER WARNINGS:
WARNING: kfunc_implicit_args.c:40 calls deprecated kfunc bpf_kfunc_implicit_arg_legacy_impl(), which will be removed.
WARNING: Switch to kfunc bpf_kfunc_implicit_arg_legacy() instead.
WARNING: For older kernels, choose the kfunc using bpf_ksym_exists(bpf_kfunc_implicit_arg_legacy).
...

Once GCC BTF tags are available this can be done by annotating kfuncs with
appropriate tags containing the deprecation message, until then we put it in
the verifier for _impl suffixed kfuncs that have been replaced with
KF_IMPLICIT_ARGS variants.

Kumar Kartikeya Dwivedi (3):
  bpf: Extract bpf_get_linfo_file_line
  bpf: Emit verifier warnings through prog stderr
  libbpf: Wire up verifier warning display logic

 include/linux/bpf.h          | 11 ++++++++
 include/linux/bpf_verifier.h |  3 +-
 kernel/bpf/core.c            | 32 ++++++++++++++++------
 kernel/bpf/log.c             |  6 ++--
 kernel/bpf/verifier.c        | 53 ++++++++++++++++++++++++++++++++++++
 tools/lib/bpf/libbpf.c       | 23 ++++++++++++++++
 6 files changed, 115 insertions(+), 13 deletions(-)


base-commit: b6b5e0ebd429d66ce37ae5af649a74ea1f041d92
-- 
2.52.0


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

end of thread, other threads:[~2026-03-30 23:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-29 21:25 [PATCH bpf-next v1 0/3] Add support to emit verifier warnings Kumar Kartikeya Dwivedi
2026-03-29 21:25 ` [PATCH bpf-next v1 1/3] bpf: Extract bpf_get_linfo_file_line Kumar Kartikeya Dwivedi
2026-03-30 11:28   ` Mykyta Yatsenko
2026-03-30 12:27   ` Puranjay Mohan
2026-03-30 12:35   ` Puranjay Mohan
2026-03-29 21:25 ` [PATCH bpf-next v1 2/3] bpf: Emit verifier warnings through prog stderr Kumar Kartikeya Dwivedi
2026-03-30 11:39   ` Mykyta Yatsenko
2026-03-30 12:39     ` Puranjay Mohan
2026-03-30 15:02   ` Alexei Starovoitov
2026-03-29 21:25 ` [PATCH bpf-next v1 3/3] libbpf: Wire up verifier warning display logic Kumar Kartikeya Dwivedi
2026-03-30 12:56   ` Mykyta Yatsenko
2026-03-30 23:46   ` Andrii Nakryiko

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