All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Steven Rostedt <rostedt@goodmis.org>
Subject: Re: memory leaks of ftrace_hash
Date: Sun, 1 Feb 2026 22:12:36 +0100	[thread overview]
Message-ID: <aX_BxG5EJTJdCMT9@krava> (raw)
In-Reply-To: <CAADnVQLVYsosBeGEhB2uxyOKNB9aS94vmR9bQb7RY3jVR2iFxA@mail.gmail.com>

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);
 	}
 

      reply	other threads:[~2026-02-01 21:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-31  3:50 memory leaks of ftrace_hash Alexei Starovoitov
2026-02-01 21:12 ` Jiri Olsa [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aX_BxG5EJTJdCMT9@krava \
    --to=olsajiri@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.