Skip to content

Commit 20dc384

Browse files
SaschaOrtmannrostedt
authored andcommitted
tracing/boottime: Fix kprobe multiple events
Fix boottime kprobe events to report and abort after each failure when adding probes. As an example, when we try to set multiprobe kprobe events in bootconfig like this: ftrace.event.kprobes.vfsevents { probes = "vfs_read $arg1 $arg2,, !error! not reported;?", // leads to error "vfs_write $arg1 $arg2" } This will not work as expected. After commit da0f1f4 ("tracing/boottime: Fix kprobe event API usage"), the function trace_boot_add_kprobe_event will not produce any error message when adding a probe fails at kprobe_event_gen_cmd_start. Furthermore, we continue to add probes when kprobe_event_gen_cmd_end fails (and kprobe_event_gen_cmd_start did not fail). In this case the function even returns successfully when the last call to kprobe_event_gen_cmd_end is successful. The behaviour of reporting and aborting after failures is not consistent. The function trace_boot_add_kprobe_event now reports each failure and stops adding probes immediately. Link: https://lkml.kernel.org/r/20200618163301.25854-1-sascha.ortmann@stud.uni-hannover.de Cc: stable@vger.kernel.org Cc: linux-kernel@i4.cs.fau.de Co-developed-by: Maximilian Werner <maximilian.werner96@gmail.com> Fixes: da0f1f4 ("tracing/boottime: Fix kprobe event API usage") Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Maximilian Werner <maximilian.werner96@gmail.com> Signed-off-by: Sascha Ortmann <sascha.ortmann@stud.uni-hannover.de> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent 6784bea commit 20dc384

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎kernel/trace/trace_boot.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,16 @@ trace_boot_add_kprobe_event(struct xbc_node *node, const char *event)
101101
kprobe_event_cmd_init(&cmd, buf, MAX_BUF_LEN);
102102

103103
ret = kprobe_event_gen_cmd_start(&cmd, event, val);
104-
if (ret)
104+
if (ret) {
105+
pr_err("Failed to generate probe: %s\n", buf);
105106
break;
107+
}
106108

107109
ret = kprobe_event_gen_cmd_end(&cmd);
108-
if (ret)
110+
if (ret) {
109111
pr_err("Failed to add probe: %s\n", buf);
112+
break;
113+
}
110114
}
111115

112116
return ret;

0 commit comments

Comments
 (0)