Re: [PATCH v6 2/4] tracing: Make the backup instance non-reusable

From: Steven Rostedt

Date: Mon Feb 09 2026 - 18:43:09 EST


On Mon, 9 Feb 2026 18:08:44 +0900
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> wrote:
> > > @@ -5152,6 +5157,9 @@ tracing_cpumask_write(struct file *filp, const char __user *ubuf,
> > > cpumask_var_t tracing_cpumask_new;
> > > int err;
> > >
> > > + if (trace_array_is_readonly(tr))
> > > + return -EPERM;
> > > +
> >
> > Shouldn't these checks be done in the open function? Doing it now is
> > too late, as -EPERM on a write is confusing when the open for write
> > succeeds.
>
> I've made a small program and straced. Surprisingly, for the super user,
> open(2) does not return error on opening a readonly file with O_RDWR.

*blink*

So if on open, the trace_array_is_read_only(tr) returns true and you
return -EPREM, it still succeeds? That sounds like a bug!

-- Steve