On Fri, Nov 12, 2021 at 07:56:23AM IST, Alexei Starovoitov wrote: > Hi Kumar, > > I think I noticed a small regression: > > $ bpftool prog load -L ./test_ksyms_module.o > > will print: > "loader prog leaked 2 FDs" > > That's a builtin sanity test in bpftool that checks > that loader prog is doing the right thing. > I suspect the cleanup path of ksym patches is leaving FD opened. > > $ cat /sys/kernel/debug/tracing/trace_pipe > bpftool-1356 [002] d..21 175.537998: bpf_trace_printk: > btf_load size 1895 r=5 > bpftool-1356 [002] d..21 175.538085: bpf_trace_printk: > map_create test_ksy.bss idx 0 type 2 value_size 4 value_btf_id 32 r=6 > bpftool-1356 [002] d..21 175.538108: bpf_trace_printk: > update_elem idx 0 value_size 4 r=0 > bpftool-1356 [002] d..21 175.538165: bpf_trace_printk: > map_create test_ksy.rodata idx 1 type 2 value_size 4 value_btf_id 34 > r=7 > bpftool-1356 [002] d..21 175.538187: bpf_trace_printk: > update_elem idx 1 value_size 4 r=0 > bpftool-1356 [002] d..21 175.538191: bpf_trace_printk: > map_freeze r=0 > bpftool-1356 [002] d..21 175.540873: bpf_trace_printk: > find_by_name_kind(bpf_testmod_invalid_mod_kfunc,12) r=-2 > bpftool-1356 [002] d..21 175.540876: bpf_trace_printk: > func (bpf_testmod_invalid_mod_kfunc:count=1): imm: 0, off: 0 > bpftool-1356 [002] d..21 175.540877: bpf_trace_printk: > func (bpf_testmod_invalid_mod_kfunc:count=1): btf_fd r=0 > bpftool-1356 [002] d..21 175.543305: bpf_trace_printk: > find_by_name_kind(bpf_testmod_test_mod_kfunc,12) r=-2 > > I see this leak with other tests too as long as they fail to load. > On success the cleanup of FD is good. > > Any idea? Ack, I'll take a look. -- Kartikeya