memory leaks of ftrace_hash
Hi Jiri,
I see a lot of:
unreferenced object 0xff1100012c967540 (size 32):
comm "test_progs", pid 2052, jiffies 4294681345
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 b8 be 65 06 01 00 11 ff ..........e.....
74 3f 5b 83 ff ff ff ff 80 0d 01 a0 ff ff ff ff t?[.............
backtrace (crc 8dddf0a9):
__kmalloc_cache_noprof+0x3a5/0x520
add_ftrace_hash_entry_direct+0x4a/0x2e0
alloc_and_copy_ftrace_hash+0x15a/0x280
hash_sub+0x3a/0x470
update_ftrace_direct_del+0x349/0x7d0
bpf_trampoline_update+0xa9c/0x1070
bpf_trampoline_unlink_prog+0x287/0x600
bpf_tracing_link_release+0x5f/0x100
bpf_link_free+0xca/0x300
bpf_link_release+0x48/0x60
__fput+0x2fc/0x9d0
fput_close_sync+0xcd/0x170
__x64_sys_close+0x7d/0xd0
do_syscall_64+0x46/0xfc0
entry_SYSCALL_64_after_hwframe+0x4b/0x53just running the latest bpf-next.
I suspect it's due to your recent changes in the area.
Pls take a look.
Quoted 25 lines · Alexei Starovoitov
Hi Jiri,
I see a lot of:
unreferenced object0xff1100012c967540(size 32):
comm "test_progs", pid 2052, jiffies 4294681345
hex dump (first 32 bytes):00 00 00 00 00 00 00 00 b8 be 65 06 01 00 11 ff ..........e..... 74 3f 5b 83 ff ff ff ff 80 0d 01 a0 ff ff ff ff t?[............. backtrace (crc 8dddf0a9): __kmalloc_cache_noprof+0x3a5/0x520 add_ftrace_hash_entry_direct+0x4a/0x2e0 alloc_and_copy_ftrace_hash+0x15a/0x280 hash_sub+0x3a/0x470 update_ftrace_direct_del+0x349/0x7d0 bpf_trampoline_update+0xa9c/0x1070 bpf_trampoline_unlink_prog+0x287/0x600 bpf_tracing_link_release+0x5f/0x100 bpf_link_free+0xca/0x300 bpf_link_release+0x48/0x60 __fput+0x2fc/0x9d0 fput_close_sync+0xcd/0x170 __x64_sys_close+0x7d/0xd0 do_syscall_64+0x46/0xfc0 entry_SYSCALL_64_after_hwframe+0x4b/0x53
Quoted 5 lines
just running the latest bpf-next.
I suspect it's due to your recent changes in the area.
Pls take a look.
hi,
argh.. I had kmemleak disabled due to small CONFIG_DEBUG_KMEMLEAK_MEM_POOL_SIZE looks like change below fixes it, I'll send a patch
thanks,
jirka
---
kernel/trace/ftrace.c +1 -0
@@ -6537,6 +6537,7 @@ int update_ftrace_direct_del(struct ftrace_ops *ops, struct ftrace_hash *hash)/* free the new_direct_functions */ old_direct_functions = new_direct_functions; }else { + old_direct_functions = direct_functions;rcu_assign_pointer (direct_functions, new_direct_functions); }