Re: [for-linus][PATCH 2/5] tracing/uprobe: Fix double perf_event linking on multiprobe uprobe

From: Peter Zijlstra
Date: Tue Jan 21 2020 - 09:50:38 EST


On Tue, Jan 21, 2020 at 09:38:49AM -0500, Steven Rostedt wrote:
> diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
> index 4ee703728aec..03e4e180058d 100644
> --- a/kernel/trace/trace_probe.h
> +++ b/kernel/trace/trace_probe.h
> @@ -230,6 +230,7 @@ struct trace_probe_event {
> struct trace_event_call call;
> struct list_head files;
> struct list_head probes;
> + char data[0];
> };

Note that this relies on pure 'luck'. If you stick anything <4 bytes in
between the list_head and the data member it'll come unstuck real fast.

> +static struct trace_uprobe_filter *
> +trace_uprobe_get_filter(struct trace_uprobe *tu)
> +{
> + struct trace_probe_event *event = tu->tp.event;
> +
> + return (struct trace_uprobe_filter *)&event->data[0];
> +}

That is, the above does not consider the alignment requirements of
struct trace_uprobe_filter.