Message ID | 20230404194504.5790b95f@gandalf.local.home |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp231513vqo; Tue, 4 Apr 2023 17:04:22 -0700 (PDT) X-Google-Smtp-Source: AKy350Z/SVfAqE0SrxjM80w4KnrOSVdqQveXemrjEm130sZuoLAPz9mTuNFvA9CNLSrKFidkqxHf X-Received: by 2002:a17:902:da88:b0:1a0:6d9e:3c78 with SMTP id j8-20020a170902da8800b001a06d9e3c78mr5052707plx.53.1680653062048; Tue, 04 Apr 2023 17:04:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680653062; cv=none; d=google.com; s=arc-20160816; b=lkgKYl9JDyMogoj7I4+iB+BUUsUGXTuzMPahBGWm44VlsPmFHbKZ5dmRex3dj2I5xf tBm+AndcOTcl6AOgsv3bwhN/OKZWgXl4t+Q4oMD63My7Dwv32B534qSKC+0jYC24qunB hF5h06vFiddA9mVmuX8itxfOU9HX6ido49maQ/uOy8zs5YbpMS1fandLRFoRr6flIUpo 05vIdbvfPeFPMhviUIMXTC0cz7wHUYyipAVANMoUmBZqFA61lJ9Q+FklI2I/IVjDUWzC olErKimbek/sZRkvo5zLCVOPCLGMdBaBkBQjPlICcUYtd5wUsmyiS4mxmM2T63pPGXrT DM1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:subject:cc:to:from:date; bh=or5BpsZc36WuOYTxTU0NhbcdTRsotGuVLZ4ifWRsLbY=; b=XpBeJF64Tt03DJXFcPtg6wk+9TGFIob4Be6z96bdqs+zhQigvehsfqnuN7PGgwr+wy 5luqg3Svrf5AAtttG7Gzp3iqWDzTN14P1nAq0TY+cH+RSLDvZ2Yp121U3GAiHWv8a8Rp 1w6a5mYdR05oT6h9GKLBe9xWGxO3v+XQs+8UJ5fIV1rkyzq0AeBn8UcWxvhv9blIKJG8 1o2uRQKR6Rp6u5pbMoNIgR5x70P9/XEIr3fZqfAsrX2pgN3wgxT0T8kktKItA3VDos/+ 9eqs70+GukWCKoAQS2W6dKD529EiCwWDp4t2cW8cUG0nKxCwyi2CKDvhIpL1gqta1qUV FWjw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020a170902f35200b0019f27fe9d45si10323257ple.463.2023.04.04.17.03.36; Tue, 04 Apr 2023 17:04:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236622AbjDDXpM (ORCPT <rfc822;lkml4gm@gmail.com> + 99 others); Tue, 4 Apr 2023 19:45:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236619AbjDDXpK (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 4 Apr 2023 19:45:10 -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 269824216; Tue, 4 Apr 2023 16:45:08 -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 6BF1B63AC8; Tue, 4 Apr 2023 23:45:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5AB4C433D2; Tue, 4 Apr 2023 23:45:05 +0000 (UTC) Date: Tue, 4 Apr 2023 19:45:04 -0400 From: Steven Rostedt <rostedt@goodmis.org> To: LKML <linux-kernel@vger.kernel.org>, Linux Trace Kernel <linux-trace-kernel@vger.kernel.org> Cc: Masami Hiramatsu <mhiramat@kernel.org>, Andrew Morton <akpm@linux-foundation.org>, Mark Rutland <mark.rutland@arm.com>, Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>, Thorsten Leemhuis <regressions@leemhuis.info>, Ulf Hansson <ulf.hansson@linaro.org>, Eric Biggers <ebiggers@kernel.org> Subject: [PATCH] tracing: Free error logs of tracing instances Message-ID: <20230404194504.5790b95f@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 X-Spam-Status: No, score=-2.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762292465026627298?= X-GMAIL-MSGID: =?utf-8?q?1762292465026627298?= |
Series |
tracing: Free error logs of tracing instances
|
|
Commit Message
Steven Rostedt
April 4, 2023, 11:45 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org> When a tracing instance is removed, the error messages that hold errors that occurred in the instance needs to be freed. The following reports a memory leak: # cd /sys/kernel/tracing # mkdir instances/foo # echo 'hist:keys=x' > instances/foo/events/sched/sched_switch/trigger # cat instances/foo/error_log [ 117.404795] hist:sched:sched_switch: error: Couldn't find field Command: hist:keys=x ^ # rmdir instances/foo Then check for memory leaks: # echo scan > /sys/kernel/debug/kmemleak # cat /sys/kernel/debug/kmemleak unreferenced object 0xffff88810d8ec700 (size 192): comm "bash", pid 869, jiffies 4294950577 (age 215.752s) hex dump (first 32 bytes): 60 dd 68 61 81 88 ff ff 60 dd 68 61 81 88 ff ff `.ha....`.ha.... a0 30 8c 83 ff ff ff ff 26 00 0a 00 00 00 00 00 .0......&....... backtrace: [<00000000dae26536>] kmalloc_trace+0x2a/0xa0 [<00000000b2938940>] tracing_log_err+0x277/0x2e0 [<000000004a0e1b07>] parse_atom+0x966/0xb40 [<0000000023b24337>] parse_expr+0x5f3/0xdb0 [<00000000594ad074>] event_hist_trigger_parse+0x27f8/0x3560 [<00000000293a9645>] trigger_process_regex+0x135/0x1a0 [<000000005c22b4f2>] event_trigger_write+0x87/0xf0 [<000000002cadc509>] vfs_write+0x162/0x670 [<0000000059c3b9be>] ksys_write+0xca/0x170 [<00000000f1cddc00>] do_syscall_64+0x3e/0xc0 [<00000000868ac68c>] entry_SYSCALL_64_after_hwframe+0x72/0xdc unreferenced object 0xffff888170c35a00 (size 32): comm "bash", pid 869, jiffies 4294950577 (age 215.752s) hex dump (first 32 bytes): 0a 20 20 43 6f 6d 6d 61 6e 64 3a 20 68 69 73 74 . Command: hist 3a 6b 65 79 73 3d 78 0a 00 00 00 00 00 00 00 00 :keys=x......... backtrace: [<000000006a747de5>] __kmalloc+0x4d/0x160 [<000000000039df5f>] tracing_log_err+0x29b/0x2e0 [<000000004a0e1b07>] parse_atom+0x966/0xb40 [<0000000023b24337>] parse_expr+0x5f3/0xdb0 [<00000000594ad074>] event_hist_trigger_parse+0x27f8/0x3560 [<00000000293a9645>] trigger_process_regex+0x135/0x1a0 [<000000005c22b4f2>] event_trigger_write+0x87/0xf0 [<000000002cadc509>] vfs_write+0x162/0x670 [<0000000059c3b9be>] ksys_write+0xca/0x170 [<00000000f1cddc00>] do_syscall_64+0x3e/0xc0 [<00000000868ac68c>] entry_SYSCALL_64_after_hwframe+0x72/0xdc The problem is that the error log needs to be freed when the instance is removed. Link: https://lore.kernel.org/lkml/76134d9f-a5ba-6a0d-37b3-28310b4a1e91@alu.unizg.hr/ Cc: stable@vger.kernel.org Fixes: 2f754e771b1a6 ("tracing: Have the error logs show up in the proper instances") Reported-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> --- kernel/trace/trace.c | 1 + 1 file changed, 1 insertion(+)
Comments
On 05. 04. 2023. 01:45, Steven Rostedt wrote: > From: "Steven Rostedt (Google)" <rostedt@goodmis.org> > > When a tracing instance is removed, the error messages that hold errors > that occurred in the instance needs to be freed. The following reports a > memory leak: > > # cd /sys/kernel/tracing > # mkdir instances/foo > # echo 'hist:keys=x' > instances/foo/events/sched/sched_switch/trigger > # cat instances/foo/error_log > [ 117.404795] hist:sched:sched_switch: error: Couldn't find field > Command: hist:keys=x > ^ > # rmdir instances/foo > > Then check for memory leaks: > > # echo scan > /sys/kernel/debug/kmemleak > # cat /sys/kernel/debug/kmemleak > unreferenced object 0xffff88810d8ec700 (size 192): > comm "bash", pid 869, jiffies 4294950577 (age 215.752s) > hex dump (first 32 bytes): > 60 dd 68 61 81 88 ff ff 60 dd 68 61 81 88 ff ff `.ha....`.ha.... > a0 30 8c 83 ff ff ff ff 26 00 0a 00 00 00 00 00 .0......&....... > backtrace: > [<00000000dae26536>] kmalloc_trace+0x2a/0xa0 > [<00000000b2938940>] tracing_log_err+0x277/0x2e0 > [<000000004a0e1b07>] parse_atom+0x966/0xb40 > [<0000000023b24337>] parse_expr+0x5f3/0xdb0 > [<00000000594ad074>] event_hist_trigger_parse+0x27f8/0x3560 > [<00000000293a9645>] trigger_process_regex+0x135/0x1a0 > [<000000005c22b4f2>] event_trigger_write+0x87/0xf0 > [<000000002cadc509>] vfs_write+0x162/0x670 > [<0000000059c3b9be>] ksys_write+0xca/0x170 > [<00000000f1cddc00>] do_syscall_64+0x3e/0xc0 > [<00000000868ac68c>] entry_SYSCALL_64_after_hwframe+0x72/0xdc > unreferenced object 0xffff888170c35a00 (size 32): > comm "bash", pid 869, jiffies 4294950577 (age 215.752s) > hex dump (first 32 bytes): > 0a 20 20 43 6f 6d 6d 61 6e 64 3a 20 68 69 73 74 . Command: hist > 3a 6b 65 79 73 3d 78 0a 00 00 00 00 00 00 00 00 :keys=x......... > backtrace: > [<000000006a747de5>] __kmalloc+0x4d/0x160 > [<000000000039df5f>] tracing_log_err+0x29b/0x2e0 > [<000000004a0e1b07>] parse_atom+0x966/0xb40 > [<0000000023b24337>] parse_expr+0x5f3/0xdb0 > [<00000000594ad074>] event_hist_trigger_parse+0x27f8/0x3560 > [<00000000293a9645>] trigger_process_regex+0x135/0x1a0 > [<000000005c22b4f2>] event_trigger_write+0x87/0xf0 > [<000000002cadc509>] vfs_write+0x162/0x670 > [<0000000059c3b9be>] ksys_write+0xca/0x170 > [<00000000f1cddc00>] do_syscall_64+0x3e/0xc0 > [<00000000868ac68c>] entry_SYSCALL_64_after_hwframe+0x72/0xdc > > The problem is that the error log needs to be freed when the instance is > removed. > > Link: https://lore.kernel.org/lkml/76134d9f-a5ba-6a0d-37b3-28310b4a1e91@alu.unizg.hr/ > > Cc: stable@vger.kernel.org > Fixes: 2f754e771b1a6 ("tracing: Have the error logs show up in the proper instances") > Reported-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr> > Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> > --- > kernel/trace/trace.c | 1 + > 1 file changed, 1 insertion(+) > > 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); Hello, Apparently, this fixed the issue (leak) with the same config, kernel commit and HW. Please add Tested-by: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr> at your convenience. The bisect was obviously misleading, but not intentionally. This is the first time my bisect was wrong (out of five or six), so I will thoroughly investigate the fault, for - needless to say - quality binary search bisect is essential to hunt down bugs. But they say that "Nobody wins them all." Thank you very much for patching this at such a short notice. (I cannot remember why I did not Cc: kernel/trace developers back then on Jan 27th, probably I thought the test independently triggered vfs_write() bug.) Have a nice evening, and God bless!! Best regards, Mirsad
On 5.4.2023. 5:57, Mirsad Goran Todorovac wrote: > On 05. 04. 2023. 01:45, Steven Rostedt wrote: >> From: "Steven Rostedt (Google)" <rostedt@goodmis.org> >> >> When a tracing instance is removed, the error messages that hold errors >> that occurred in the instance needs to be freed. The following reports a >> memory leak: >> >> # cd /sys/kernel/tracing >> # mkdir instances/foo >> # echo 'hist:keys=x' > instances/foo/events/sched/sched_switch/trigger >> # cat instances/foo/error_log >> [ 117.404795] hist:sched:sched_switch: error: Couldn't find field >> Command: hist:keys=x >> ^ >> # rmdir instances/foo >> >> Then check for memory leaks: >> >> # echo scan > /sys/kernel/debug/kmemleak >> # cat /sys/kernel/debug/kmemleak >> unreferenced object 0xffff88810d8ec700 (size 192): >> comm "bash", pid 869, jiffies 4294950577 (age 215.752s) >> hex dump (first 32 bytes): >> 60 dd 68 61 81 88 ff ff 60 dd 68 61 81 88 ff ff `.ha....`.ha.... >> a0 30 8c 83 ff ff ff ff 26 00 0a 00 00 00 00 00 .0......&....... >> backtrace: >> [<00000000dae26536>] kmalloc_trace+0x2a/0xa0 >> [<00000000b2938940>] tracing_log_err+0x277/0x2e0 >> [<000000004a0e1b07>] parse_atom+0x966/0xb40 >> [<0000000023b24337>] parse_expr+0x5f3/0xdb0 >> [<00000000594ad074>] event_hist_trigger_parse+0x27f8/0x3560 >> [<00000000293a9645>] trigger_process_regex+0x135/0x1a0 >> [<000000005c22b4f2>] event_trigger_write+0x87/0xf0 >> [<000000002cadc509>] vfs_write+0x162/0x670 >> [<0000000059c3b9be>] ksys_write+0xca/0x170 >> [<00000000f1cddc00>] do_syscall_64+0x3e/0xc0 >> [<00000000868ac68c>] entry_SYSCALL_64_after_hwframe+0x72/0xdc >> unreferenced object 0xffff888170c35a00 (size 32): >> comm "bash", pid 869, jiffies 4294950577 (age 215.752s) >> hex dump (first 32 bytes): >> 0a 20 20 43 6f 6d 6d 61 6e 64 3a 20 68 69 73 74 . Command: hist >> 3a 6b 65 79 73 3d 78 0a 00 00 00 00 00 00 00 00 :keys=x......... >> backtrace: >> [<000000006a747de5>] __kmalloc+0x4d/0x160 >> [<000000000039df5f>] tracing_log_err+0x29b/0x2e0 >> [<000000004a0e1b07>] parse_atom+0x966/0xb40 >> [<0000000023b24337>] parse_expr+0x5f3/0xdb0 >> [<00000000594ad074>] event_hist_trigger_parse+0x27f8/0x3560 >> [<00000000293a9645>] trigger_process_regex+0x135/0x1a0 >> [<000000005c22b4f2>] event_trigger_write+0x87/0xf0 >> [<000000002cadc509>] vfs_write+0x162/0x670 >> [<0000000059c3b9be>] ksys_write+0xca/0x170 >> [<00000000f1cddc00>] do_syscall_64+0x3e/0xc0 >> [<00000000868ac68c>] entry_SYSCALL_64_after_hwframe+0x72/0xdc >> >> The problem is that the error log needs to be freed when the instance is >> removed. >> >> Link: https://lore.kernel.org/lkml/76134d9f-a5ba-6a0d-37b3-28310b4a1e91@alu.unizg.hr/ >> >> Cc: stable@vger.kernel.org >> Fixes: 2f754e771b1a6 ("tracing: Have the error logs show up in the proper instances") >> Reported-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr> >> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> >> --- >> kernel/trace/trace.c | 1 + >> 1 file changed, 1 insertion(+) >> >> 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); > > Hello, > > Apparently, this fixed the issue (leak) with the same config, kernel commit and > HW. > > Please add > > Tested-by: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr> > > at your convenience. > > The bisect was obviously misleading, but not intentionally. This is the first time > my bisect was wrong (out of five or six), so I will thoroughly investigate the fault, > for - needless to say - quality binary search bisect is essential to hunt down bug. I found the culprit. I have naively classified build 6.1.0-ftrace-06910-g90b12f423d3c as "good", giving me a false negative. It turned out that it takes at least two attempts on # echo scan > /sys/kernel/debug/kmemleak to display the "ftracetest" leak in the # cat /sys/kernel/debug/kmemleak output. First try again showed no leaks. The log shows "looks good". I don't remember what I did on Jan/26th, but it was obviously not good enough. Mea culpa. The leak is present already in the v5.9.0, which is earliest which I can boot with the default kmod v30+20220630-3ubuntu1 and default ZSTD kernel compression. If it mattered, I could proceed bisect on the other device (we'd get Fixes: line, but the bug is already patched). Best regards, Mirsad
On Wed, 5 Apr 2023 12:47:08 +0200 Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr> wrote: > >> Cc: stable@vger.kernel.org > >> Fixes: 2f754e771b1a6 ("tracing: Have the error logs show up in the proper instances") > > > > Please add > > > > Tested-by: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr> Thanks! > > If it mattered, I could proceed bisect on the other device (we'd get Fixes: > line, but the bug is already patched). I'm pretty sure the above commit listed in the Fixes tag is the culprit. Feel free to test before and after to confirm. -- Steve
On Tue, 4 Apr 2023 19:45:04 -0400 Steven Rostedt <rostedt@goodmis.org> wrote: > From: "Steven Rostedt (Google)" <rostedt@goodmis.org> > > When a tracing instance is removed, the error messages that hold errors > that occurred in the instance needs to be freed. The following reports a > memory leak: > > # cd /sys/kernel/tracing > # mkdir instances/foo > # echo 'hist:keys=x' > instances/foo/events/sched/sched_switch/trigger > # cat instances/foo/error_log > [ 117.404795] hist:sched:sched_switch: error: Couldn't find field > Command: hist:keys=x > ^ > # rmdir instances/foo > > Then check for memory leaks: > > # echo scan > /sys/kernel/debug/kmemleak > # cat /sys/kernel/debug/kmemleak > unreferenced object 0xffff88810d8ec700 (size 192): > comm "bash", pid 869, jiffies 4294950577 (age 215.752s) > hex dump (first 32 bytes): > 60 dd 68 61 81 88 ff ff 60 dd 68 61 81 88 ff ff `.ha....`.ha.... > a0 30 8c 83 ff ff ff ff 26 00 0a 00 00 00 00 00 .0......&....... > backtrace: > [<00000000dae26536>] kmalloc_trace+0x2a/0xa0 > [<00000000b2938940>] tracing_log_err+0x277/0x2e0 > [<000000004a0e1b07>] parse_atom+0x966/0xb40 > [<0000000023b24337>] parse_expr+0x5f3/0xdb0 > [<00000000594ad074>] event_hist_trigger_parse+0x27f8/0x3560 > [<00000000293a9645>] trigger_process_regex+0x135/0x1a0 > [<000000005c22b4f2>] event_trigger_write+0x87/0xf0 > [<000000002cadc509>] vfs_write+0x162/0x670 > [<0000000059c3b9be>] ksys_write+0xca/0x170 > [<00000000f1cddc00>] do_syscall_64+0x3e/0xc0 > [<00000000868ac68c>] entry_SYSCALL_64_after_hwframe+0x72/0xdc > unreferenced object 0xffff888170c35a00 (size 32): > comm "bash", pid 869, jiffies 4294950577 (age 215.752s) > hex dump (first 32 bytes): > 0a 20 20 43 6f 6d 6d 61 6e 64 3a 20 68 69 73 74 . Command: hist > 3a 6b 65 79 73 3d 78 0a 00 00 00 00 00 00 00 00 :keys=x......... > backtrace: > [<000000006a747de5>] __kmalloc+0x4d/0x160 > [<000000000039df5f>] tracing_log_err+0x29b/0x2e0 > [<000000004a0e1b07>] parse_atom+0x966/0xb40 > [<0000000023b24337>] parse_expr+0x5f3/0xdb0 > [<00000000594ad074>] event_hist_trigger_parse+0x27f8/0x3560 > [<00000000293a9645>] trigger_process_regex+0x135/0x1a0 > [<000000005c22b4f2>] event_trigger_write+0x87/0xf0 > [<000000002cadc509>] vfs_write+0x162/0x670 > [<0000000059c3b9be>] ksys_write+0xca/0x170 > [<00000000f1cddc00>] do_syscall_64+0x3e/0xc0 > [<00000000868ac68c>] entry_SYSCALL_64_after_hwframe+0x72/0xdc > > The problem is that the error log needs to be freed when the instance is > removed. > > Link: https://lore.kernel.org/lkml/76134d9f-a5ba-6a0d-37b3-28310b4a1e91@alu.unizg.hr/ > > Cc: stable@vger.kernel.org > Fixes: 2f754e771b1a6 ("tracing: Have the error logs show up in the proper instances") > Reported-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr> > Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> This looks good to me. Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Thank you! > --- > kernel/trace/trace.c | 1 + > 1 file changed, 1 insertion(+) > > 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); > -- > 2.39.2 >
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);