Commit fbfdf00
bpf: correctly free bpf_scc_info objects referenced in env->scc_info
env->scc_info array contains references to bpf_scc_info objects
allocated lazily in verifier.c:scc_visit_alloc().
env->scc_cnt was supposed to track env->scc_info array size
in order to free referenced objects in verifier.c:free_states().
Initialization of env->scc_cnt was omitted in
verifier.c:compute_scc(), which is fixed by this commit.
To reproduce the bug:
- build with CONFIG_DEBUG_KMEMLEAK
- boot and load bpf program with loops, e.g.:
./veristat -q pyperf180.bpf.o
- initiate memleak scan and check results:
echo scan > /sys/kernel/debug/kmemleak
cat /sys/kernel/debug/kmemleak
Fixes: c9e3190 ("bpf: propagate read/precision marks over state graph backedges")
Reported-by: Jens Axboe <[email protected]>
Closes: https://lore.kernel.org/bpf/CAADnVQKXUWg9uRCPD5ebRXwN4dmBCRUFFM7kN=GxymYz3zU25A@mail.gmail.com/T/
Suggested-by: Alexei Starovoitov <[email protected]>
Signed-off-by: Eduard Zingerman <[email protected]>1 parent 837ec5d commit fbfdf00
1 file changed
+3
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23114 | 23114 | | |
23115 | 23115 | | |
23116 | 23116 | | |
| 23117 | + | |
| 23118 | + | |
23117 | 23119 | | |
23118 | 23120 | | |
23119 | 23121 | | |
| |||
24554 | 24556 | | |
24555 | 24557 | | |
24556 | 24558 | | |
| 24559 | + | |
24557 | 24560 | | |
24558 | 24561 | | |
24559 | 24562 | | |
| |||
0 commit comments