From: Ihor Solodrai <ihor.solodrai@linux.dev>
To: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: Tejun Heo <tj@kernel.org>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@meta.com
Subject: [PATCH bpf v2 0/2] bpf: Fix tracing of kfuncs with implicit args
Date: Fri, 10 Jul 2026 12:29:38 -0700 [thread overview]
Message-ID: <20260710192940.3020280-1-ihor.solodrai@linux.dev> (raw)
Tejun reported an issue where a BPF program tracing a kfunc with
KF_IMPLICIT_ARGS can crash the kernel [1]. This is caused by a bug in
bpf_check_attach_target(): the btf_func_model for such a kfunc is
computed from a wrong BTF prototype. For more details see the commit
message of patch #1.
The second patch adds a selftest that can catch this situation.
The fix is a candidate for 7.1 backport.
[1] https://github.com/sched-ext/scx/issues/3687#issuecomment-4906694106
---
v1->v2:
* Take a module reference in btf_attach_func_proto() around the
btf_kfunc_accumulated_flags() call (sashiko)
v1: https://lore.kernel.org/bpf/20260710005902.2234832-1-ihor.solodrai@linux.dev/
---
Ihor Solodrai (1):
bpf: Fix tracing of kfuncs with implicit args
Kumar Kartikeya Dwivedi (1):
selftests/bpf: Cover tracing implicit kfunc args
include/linux/btf.h | 1 +
kernel/bpf/btf.c | 20 +++++
kernel/bpf/verifier.c | 64 +++++++++++----
.../prog_tests/kfunc_implicit_args_tracing.c | 36 +++++++++
.../bpf/progs/kfunc_implicit_args_tracing.c | 77 +++++++++++++++++++
5 files changed, 185 insertions(+), 13 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/kfunc_implicit_args_tracing.c
create mode 100644 tools/testing/selftests/bpf/progs/kfunc_implicit_args_tracing.c
--
2.55.0
next reply other threads:[~2026-07-10 19:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 19:29 Ihor Solodrai [this message]
2026-07-10 19:29 ` [PATCH bpf v2 1/2] bpf: Fix tracing of kfuncs with implicit args Ihor Solodrai
2026-07-11 10:43 ` Eduard Zingerman
2026-07-11 17:57 ` Ihor Solodrai
2026-07-11 23:51 ` Eduard Zingerman
2026-07-13 16:48 ` Ihor Solodrai
2026-07-13 17:01 ` Eduard Zingerman
2026-07-13 12:51 ` Jiri Olsa
2026-07-10 19:29 ` [PATCH bpf v2 2/2] selftests/bpf: Cover tracing implicit kfunc args Ihor Solodrai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260710192940.3020280-1-ihor.solodrai@linux.dev \
--to=ihor.solodrai@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=memxor@gmail.com \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.