Re: [PATCH] tracing/uprobe: Fix to make trace_uprobe_filter alignment safe

Steven Rostedt
2020-01-21T15:51:12Z

[-- Attachment #1: Type: text/plain, Size: 4456 bytes --]

On Tue, 21 Jan 2020 16:46:19 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:

> Commit 99c9a923e97a ("tracing/uprobe: Fix double perf_event
> linking on multiprobe uprobe") moved trace_uprobe_filter on
> trace_probe_event. However, since it introduced a flexible
> data structure with char array and type casting, the
> alignment of trace_uprobe_filter can be broken.
>
> This changes the type of the array to trace_uprobe_filter
> data strucure to fix it.
>
> Fixes: 99c9a923e97a ("tracing/uprobe: Fix double perf_event linking on multiprobe uprobe")
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> ---
> kernel/trace/trace_kprobe.c | 2 +-
> kernel/trace/trace_probe.c | 9 ++++++---
> kernel/trace/trace_probe.h | 10 ++++++++--
> kernel/trace/trace_uprobe.c | 29 +++++++----------------------
> 4 files changed, 22 insertions(+), 28 deletions(-)

I hit the following build error with this:

/work/git/linux-trace.git/kernel/trace/trace_uprobe.c: In function ‘alloc_trace_uprobe’:
/work/git/linux-trace.git/kernel/trace/trace_uprobe.c:355:39: error: ‘tu->tp.event’ is a pointer; did you mean to use ‘->’?
init_trace_uprobe_filter(tu->tp.event.filter);
^
->
In file included from /work/git/linux-trace.git/arch/x86/include/asm/bug.h:83,
from /work/git/linux-trace.git/include/linux/bug.h:5,
from /work/git/linux-trace.git/arch/x86/include/asm/paravirt.h:15,
from /work/git/linux-trace.git/arch/x86/include/asm/irqflags.h:72,
from /work/git/linux-trace.git/include/linux/irqflags.h:16,
from /work/git/linux-trace.git/include/linux/rcupdate.h:26,
from /work/git/linux-trace.git/include/linux/rbtree.h:22,
from /work/git/linux-trace.git/include/linux/key.h:15,
from /work/git/linux-trace.git/include/linux/security.h:26,
from /work/git/linux-trace.git/kernel/trace/trace_uprobe.c:10:
/work/git/linux-trace.git/kernel/trace/trace_uprobe.c: In function ‘__probe_event_disable’:
/work/git/linux-trace.git/kernel/trace/trace_uprobe.c:1064:46: error: ‘tu->tp.event’ is a pointer; did you mean to use ‘->’?
WARN_ON(!uprobe_filter_is_empty(tu->tp.event.filter));
^
/work/git/linux-trace.git/include/asm-generic/bug.h:113:25: note: in definition of macro ‘WARN_ON’
int __ret_warn_on = !!(condition); \
^~~~~~~~~
/work/git/linux-trace.git/kernel/trace/trace_uprobe.c: In function ‘probe_event_enable’:
/work/git/linux-trace.git/kernel/trace/trace_uprobe.c:1105:46: error: ‘tu->tp.event’ is a pointer; did you mean to use ‘->’?
WARN_ON(!uprobe_filter_is_empty(tu->tp.event.filter));
^
/work/git/linux-trace.git/include/asm-generic/bug.h:113:25: note: in definition of macro ‘WARN_ON’
int __ret_warn_on = !!(condition); \
^~~~~~~~~
/work/git/linux-trace.git/kernel/trace/trace_uprobe.c: In function ‘uprobe_perf_close’:
/work/git/linux-trace.git/kernel/trace/trace_uprobe.c:1269:45: error: ‘tu->tp.event’ is a pointer; did you mean to use ‘->’?
if (trace_uprobe_filter_remove(tu->tp.event.filter, event))
^
->
/work/git/linux-trace.git/kernel/trace/trace_uprobe.c: In function ‘uprobe_perf_open’:
/work/git/linux-trace.git/kernel/trace/trace_uprobe.c:1294:42: error: ‘tu->tp.event’ is a pointer; did you mean to use ‘->’?
if (trace_uprobe_filter_add(tu->tp.event.filter, event))
^
->
/work/git/linux-trace.git/kernel/trace/trace_uprobe.c: In function ‘uprobe_perf_filter’:
/work/git/linux-trace.git/kernel/trace/trace_uprobe.c:1316:23: error: ‘tu->tp.event’ is a pointer; did you mean to use ‘->’?
filter = tu->tp.event.filter;
^
->
make[3]: *** [/work/git/linux-trace.git/scripts/Makefile.build:266: kernel/trace/trace_uprobe.o] Error 1
make[3]: *** Waiting for unfinished jobs....

Config attached.

-- Steve

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33816 bytes --]