Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bpf: Fix kprobe_multi cookies access in show_fdinfo callback

We don't check if cookies are available on the kprobe_multi link
before accessing them in show_fdinfo callback, we should.

Cc: stable@vger.kernel.org
Fixes: da7e9c0a7fbc ("bpf: Add show_fdinfo for kprobe_multi")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20260225111249.186230-1-jolsa@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Jiri Olsa and committed by
Alexei Starovoitov
ad6fface ef06fd16

+3 -1
+3 -1
kernel/trace/bpf_trace.c
··· 2454 2454 struct seq_file *seq) 2455 2455 { 2456 2456 struct bpf_kprobe_multi_link *kmulti_link; 2457 + bool has_cookies; 2457 2458 2458 2459 kmulti_link = container_of(link, struct bpf_kprobe_multi_link, link); 2460 + has_cookies = !!kmulti_link->cookies; 2459 2461 2460 2462 seq_printf(seq, 2461 2463 "kprobe_cnt:\t%u\n" ··· 2469 2467 for (int i = 0; i < kmulti_link->cnt; i++) { 2470 2468 seq_printf(seq, 2471 2469 "%llu\t %pS\n", 2472 - kmulti_link->cookies[i], 2470 + has_cookies ? kmulti_link->cookies[i] : 0, 2473 2471 (void *)kmulti_link->addrs[i]); 2474 2472 } 2475 2473 }