Re: [PATCH bpf v4 09/20] selftests/bpf: Refactor bpf_get_ksyms() trace helper

From: Eduard Zingerman

Date: Mon Feb 23 2026 - 18:23:57 EST


On Mon, 2026-02-23 at 11:07 -0800, Ihor Solodrai wrote:
> ASAN reported a memory leak in bpf_get_ksyms(): it allocates a struct
> ksyms internally and never frees it.
>
> Move struct ksyms to trace_helpers.h and return it from the
> bpf_get_ksyms(), giving ownership to the caller. Add filtered_syms and
> filtered_cnt fields to the ksyms to hold the filtered array of
> symbols, previously returned by bpf_get_ksyms().
>
> Fixup the call sites: kprobe_multi_test and bench_trigger.
>
> Signed-off-by: Ihor Solodrai <ihor.solodrai@xxxxxxxxx>
> ---

Acked-by: Eduard Zingerman <eddyz87@xxxxxxxxx>

[...]