[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260108120739.e85941b9d7d67f15ded52410@kernel.org>
Date: Thu, 8 Jan 2026 12:07:39 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] tracing: Make the backup instance readonly
On Wed, 7 Jan 2026 11:41:33 -0500
Steven Rostedt <rostedt@...dmis.org> wrote:
> > @@ -4888,6 +4888,9 @@ static int tracing_open(struct inode *inode, struct file *file)
> > int cpu = tracing_get_cpu(inode);
> > struct array_buffer *trace_buf = &tr->array_buffer;
> >
> > + if (trace_array_is_readonly(tr))
> > + return -EPERM;
>
> So this fails if someone opens a file in RDONLY mode?
>
> Why?
This is for `trace` file and this block is to erase the buffer.
-----
/* If this file was open for write, then erase contents */
if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) {
int cpu = tracing_get_cpu(inode);
struct array_buffer *trace_buf = &tr->array_buffer;
if (trace_array_is_readonly(tr))
return -EPERM;
-----
Thus, if user opens it RDONLY mode to read the buffer, we don't care
because it is readonly (readable).
Thank you,
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists