On Mon, 9 Feb 2026 18:08:44 +0900
Masami Hiramatsu (Google) <[email protected]> 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

Reply via email to