Re: [PATCH v2] tracing: Fix uaf issue when open the hist or hist_debug file
From: Steven Rostedt <rostedt@goodmis.org>
Date: 2023-12-13 13:01:02
Also in:
lkml
On Wed, 13 Dec 2023 09:51:38 +0800 Zheng Yejian [off-list ref] wrote:
quoted hunk ↗ jump to hunk
--- kernel/trace/trace_events_hist.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) Steve, thanks for your review! v2: - Introduce tracing_single_release_file_tr() to add the missing call for single_release() as suggested by Steve; Link: https://lore.kernel.org/all/20231212113546.6a51d359@gandalf.local.home/ (local) - Slightly modify the commit message and comments. v1: Link: https://lore.kernel.org/all/20231212113317.4159890-1-zhengyejian1@huawei.com/ (local)diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index 1abc07fba1b9..5296a08c0641 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c@@ -5619,14 +5619,22 @@ static int hist_show(struct seq_file *m, void *v) return ret; } +static int tracing_single_release_file_tr(struct inode *inode, struct file *filp) +{ + tracing_release_file_tr(inode, filp); + return single_release(inode, filp); +} +
Hi Zheng, Could you put the tracing_single_release_file_tr() into trace.c as a non static function. Put the protocol in kernel/trace/trace.h. Even though it's only used in trace_events_hist.c, I rather not hide it there. If this issue appears for another file, I would look in trace.c and trace.h for available functions to use. Thanks, -- Steve