Re: [PATCH v4 02/10] user_events: Add minimal support for trace_event into ftrace

From: Steven Rostedt
Date: Mon Nov 08 2021 - 13:16:46 EST


On Mon, 8 Nov 2021 09:13:36 -0800
Beau Belgrave <beaub@xxxxxxxxxxxxxxxxxxx> wrote:


> Does that mean the decoders in eprobes/histogram don't check event
> record sizes before accessing the data? Shouldn't that get fix
> centrally? That would mean a loaded module could do the same thing
> (user_events only works if the user has access to tracefs, so it's not
> like it's open to all users).

There's checks to make sure everything fits in eprobes and kprobes. If it
doesn't then the event is simply dropped.

For example, if you look at __eprobe_trace_func() in trace_eprobe.c, you'll
see that it calls get_eprobe_size(), which goes through and just reads what
it is about to accept. Then it reserves the amount of data on the ring
buffer, and then calls store_trace_args() which also passes in the size
that it found, in case things change. If it's too big, it only records what
it originally intended.

-- Steve