[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240725171459.598d9500@gandalf.local.home>
Date: Thu, 25 Jul 2024 17:14:59 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Mathias Krause <minipli@...ecurity.net>
Cc: Ajay Kaher <ajay.kaher@...adcom.com>, Masami Hiramatsu
<mhiramat@...nel.org>, Ilkka Naulapää
<digirigawa@...il.com>, Linus Torvalds <torvalds@...ux-foundation.org>, Al
Viro <viro@...iv.linux.org.uk>, linux-trace-kernel@...r.kernel.org,
linux-kernel@...r.kernel.org, regressions@...mhuis.info, Dan Carpenter
<dan.carpenter@...aro.org>, Vasavi Sirnapalli
<vasavi.sirnapalli@...adcom.com>, Alexey Makhalov
<alexey.makhalov@...adcom.com>, Florian Fainelli
<florian.fainelli@...adcom.com>, Beau Belgrave <beaub@...ux.microsoft.com>
Subject: Re: tracing: user events UAF crash report
On Thu, 25 Jul 2024 22:41:23 +0200
Mathias Krause <minipli@...ecurity.net> wrote:
> > diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> > index 6ef29eba90ce..5fbfa1c885de 100644
> > --- a/kernel/trace/trace_events.c
> > +++ b/kernel/trace/trace_events.c
> > @@ -1627,12 +1627,14 @@ static int f_show(struct seq_file *m, void *v)
> >
> > static void *f_start(struct seq_file *m, loff_t *pos)
> > {
> > + struct trace_event_file *file;
> > void *p = (void *)FORMAT_HEADER;
> > loff_t l = 0;
> >
> > /* ->stop() is called even if ->start() fails */
> > mutex_lock(&event_mutex);
> > - if (!event_file_data(m->private))
> > + file = event_file_data(m->private);
> > + if (!file || (file->flags & EVENT_FILE_FL_FREED))
> > return ERR_PTR(-ENODEV);
> >
> > while (l < *pos && p)
> >
> >
>
> Nope, still the same splats.
Can you reshow the splats. Because I'm now confused.
destroy_user_event() which is under event_mutex calls
user_event_set_call_visible() with false, that will then call:
trace_remove_event_call() -> probe_remove_event_call() ->
__trace_remove_event_call() -> event_remove() ->
remove_event_from_tracers()
Where remove_event_from_tracers() loops over all the instances and will set
each of the file pointers flags associated to the event: EVENT_FILE_FL_FREED
Then it returns back to destroy_user_event() that would free the event.
The f_start() that was in your crash, with the new patch, should take the
event_mutex before referencing the event that was freed. And with that flag
being set, it should exit out.
Did you remove all the other patches before applying this one?
-- Steve
Powered by blists - more mailing lists