BPF List
 help / color / mirror / Atom feed
* memory leaks of ftrace_hash
@ 2026-01-31  3:50 Alexei Starovoitov
  2026-02-01 21:12 ` Jiri Olsa
  0 siblings, 1 reply; 2+ messages in thread
From: Alexei Starovoitov @ 2026-01-31  3:50 UTC (permalink / raw)
  To: Jiri Olsa, bpf, Steven Rostedt

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/0x53

just running the latest bpf-next.

I suspect it's due to your recent changes in the area.

Pls take a look.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: memory leaks of ftrace_hash
  2026-01-31  3:50 memory leaks of ftrace_hash Alexei Starovoitov
@ 2026-02-01 21:12 ` Jiri Olsa
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Olsa @ 2026-02-01 21:12 UTC (permalink / raw)
  To: Alexei Starovoitov; +Cc: bpf, Steven Rostedt

On Fri, Jan 30, 2026 at 07:50:13PM -0800, Alexei Starovoitov wrote:
> 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/0x53
> 
> 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


---
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 8574932e66b6..b12dbd93ae1c 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -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);
 	}
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-02-01 21:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-31  3:50 memory leaks of ftrace_hash Alexei Starovoitov
2026-02-01 21:12 ` Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox