public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bpf: Fix refcount check in check_struct_ops_btf_id()
@ 2026-03-20 13:02 Keisuke Nishimura
  2026-03-20 16:57 ` sun jian
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Keisuke Nishimura @ 2026-03-20 13:02 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, John Fastabend,
	Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
	Yonghong Song, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Amery Hung
  Cc: Keisuke Nishimura, bpf, linux-kernel

The current implementation only checks whether the first argument is
refcounted. Fix this by iterating over all arguments.

Signed-off-by: Keisuke Nishimura <keisuke.nishimura@inria.fr>
Fixes: 38f1e66abd184 ("bpf: Do not allow tail call in strcut_ops program with __ref argument")
---
 kernel/bpf/verifier.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 159b25f8269d..278443118a23 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -24853,7 +24853,7 @@ static int check_struct_ops_btf_id(struct bpf_verifier_env *env)
 	}
 
 	for (i = 0; i < st_ops_desc->arg_info[member_idx].cnt; i++) {
-		if (st_ops_desc->arg_info[member_idx].info->refcounted) {
+		if (st_ops_desc->arg_info[member_idx].info[i].refcounted) {
 			has_refcounted_arg = true;
 			break;
 		}
-- 
2.34.1


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

end of thread, other threads:[~2026-03-24 16:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20 13:02 [PATCH] bpf: Fix refcount check in check_struct_ops_btf_id() Keisuke Nishimura
2026-03-20 16:57 ` sun jian
2026-03-21  1:44 ` Emil Tsalapatis
2026-03-21 15:15 ` Amery Hung
2026-03-21 20:24 ` Kumar Kartikeya Dwivedi
2026-03-21 21:40 ` [PATCH bpf-next] selftests/bpf: Add test for struct_ops __ref argument in any position Varun R Mallya
2026-03-21 22:13   ` bot+bpf-ci
2026-03-21 22:19     ` Varun R Mallya
2026-03-22  0:49   ` Keisuke Nishimura
2026-03-24 16:24   ` patchwork-bot+netdevbpf

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