Commit fd600050 authored by Sascha Ortmann's avatar Sascha Ortmann Committed by Sasha Levin
Browse files

tracing/boottime: Fix kprobe multiple events

commit 20dc3847 upstream.

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 da0f1f41 ("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

The function trace_boot_add_kprobe_event now reports each failure and
stops adding probes immediately.


Co-developed-by: default avatarMaximilian Werner <>
Fixes: da0f1f41

 ("tracing/boottime: Fix kprobe event API usage")
Acked-by: default avatarMasami Hiramatsu <>
Signed-off-by: default avatarMaximilian Werner <>
Signed-off-by: default avatarSascha Ortmann <>
Signed-off-by: default avatarSteven Rostedt (VMware) <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 3ed68843
......@@ -101,12 +101,16 @@ trace_boot_add_kprobe_event(struct xbc_node *node, const char *event)
kprobe_event_cmd_init(&cmd, buf, MAX_BUF_LEN);
ret = kprobe_event_gen_cmd_start(&cmd, event, val);
if (ret)
if (ret) {
pr_err("Failed to generate probe: %s\n", buf);
ret = kprobe_event_gen_cmd_end(&cmd);
if (ret)
if (ret) {
pr_err("Failed to add probe: %s\n", buf);
return ret;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment