Re: Need to remove char pointers from trace events

From: Steven Rostedt
Date: Wed Jul 10 2019 - 11:59:52 EST


On Wed, 10 Jul 2019 18:45:24 +0300
Ville SyrjÃlà <ville.syrjala@xxxxxxxxxxxxxxx> wrote:

> > TP_printk("pipe %c, plane %s, frame=%u, scanline=%u",
> > pipe_name(__entry->pipe), __entry->name,
> > __entry->frame, __entry->scanline)
> >
> >
> > The issue here is that you record a pointer address to "plane->name"
> > and then sometime in the distant future access that same address.
> > There's usually no guarantee that the contents at that address will
> > exist when the buffer is read.
>
> The only way those can disappear is if the device goes away. But I have
> no problem going with your patch. Want to provide a proper commit message
> for it?

Sure, but does that mean the trace data will go away with the device?
If not, then you still have the issue.

Also note that perf and trace-cmd will not know how to read that data
either, so adding it to the ring buffer gives them access.

I'll send a patch next, thanks!

-- Steve

>
> >
> > The proper way to record strings, is to record the string into the ring
> > buffer itself, and not rely on it existing hours or days later.
> >