From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7944AC761A6 for ; Tue, 4 Apr 2023 23:36:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236603AbjDDXgZ (ORCPT ); Tue, 4 Apr 2023 19:36:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236366AbjDDXgW (ORCPT ); Tue, 4 Apr 2023 19:36:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 531381736; Tue, 4 Apr 2023 16:36:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E1ED163A0B; Tue, 4 Apr 2023 23:36:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33497C433D2; Tue, 4 Apr 2023 23:36:19 +0000 (UTC) Date: Tue, 4 Apr 2023 19:36:16 -0400 From: Steven Rostedt To: Eric Biggers Cc: Mirsad Goran Todorovac , LKML , Alexander Viro , linux-fsdevel@vger.kernel.org, Thorsten Leemhuis , Ulf Hansson , Masami Hiramatsu , Shuah Khan , linux-kselftest@vger.kernel.org Subject: Re: [BUG RESEND] [BISECTED]: selftest: ftracetest: memleak in vfs_write() Message-ID: <20230404193616.378357f1@gandalf.local.home> In-Reply-To: <20230404182428.4ccd3f96@gandalf.local.home> References: <76134d9f-a5ba-6a0d-37b3-28310b4a1e91@alu.unizg.hr> <20230404220744.GB1893@sol.localdomain> <20230404182428.4ccd3f96@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 4 Apr 2023 18:24:28 -0400 Steven Rostedt wrote: > On Tue, 4 Apr 2023 15:07:44 -0700 > Eric Biggers wrote: > > > This looks like an issue with the tracing subsystem. I appreciate that you've > > now added the tracing maintainers to Cc. I don't think your bisection to commit > > 71946a25f357 ("Merge tag 'mmc-v6.2' ...") is correct; that looks unrelated. > > No that is not the correct commit. I think I see the issue. The error log > of a tracing instance doesn't seem to be freed if the instance is removed. > > I'm guessing this can cause the bug: > > # cd /sys/kernel/tracincg > # mkdir instances/foo > # echo 'p:nothing no_function_here' > instances/foo/dynamic_events OK, it required me to touch a trigger as dynamic_events only exists in the top level (and the bug report shows a filter): # echo 'hist:keys=x' > instances/foo/events/sched/sched_switch/trigger > # rmdir instances/foo > Anyway, I was able to reproduce the leak. Can you test this patch? -- Steve diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 8ae51f1dea8e..352a804b016d 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -9516,6 +9516,7 @@ static int __remove_instance(struct trace_array *tr) tracefs_remove(tr->dir); free_percpu(tr->last_func_repeats); free_trace_buffers(tr); + clear_tracing_err_log(tr); for (i = 0; i < tr->nr_topts; i++) { kfree(tr->topts[i].topts);