]> exis.tech > repos - linux.git/commit
Merge branch 'bpf-fix-tracing-of-kfuncs-with-implicit-args'
authorEduard Zingerman <eddyz87@gmail.com>
Thu, 16 Jul 2026 23:11:30 +0000 (16:11 -0700)
committerEduard Zingerman <eddyz87@gmail.com>
Thu, 16 Jul 2026 23:11:30 +0000 (16:11 -0700)
commit3d84d674e3a5a33ce5eaa14b92bc839c3821a348
tree4680b06f6bb44f7319c3313a387a4d382f5c22ba
parent4967bd533db2dc947574ee55ba44b3306ef3b7b1
parent0af15f3057a60a038864d47fa4b54d1c3c3c654c
Merge branch 'bpf-fix-tracing-of-kfuncs-with-implicit-args'

Ihor Solodrai says:

====================
bpf: Fix tracing of kfuncs with implicit args

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
---

v2->v3:
  * Replace btf_kfunc_accumulated_flags() with btf_kfunc_check_flag()
    following a discussion with Eduard. Inlining the hook walk is a
    worse option than a helper, because BTF_KFUNC_HOOK_MAX and co are
    internal to btf.c and exposing them is uglier.
  * remove reduntant btf_is_func check (Jiri)
  * formatting nit (Eduard)
v2: https://lore.kernel.org/bpf/20260710192940.3020280-1-ihor.solodrai@linux.dev/

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/

---
====================

Link: https://patch.msgid.link/20260713235223.1639022-1-ihor.solodrai@linux.dev
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>