Skip to content

Commit da0f1f4

Browse files
mhiramatrostedt
authored andcommitted
tracing/boottime: Fix kprobe event API usage
Fix boottime kprobe events to use API correctly for multiple events. For example, when we set a multiprobe kprobe events in bootconfig like below, ftrace.event.kprobes.myevent { probes = "vfs_read $arg1 $arg2", "vfs_write $arg1 $arg2" } This cause an error; trace_boot: Failed to add probe: p:kprobes/myevent (null) vfs_read $arg1 $arg2 vfs_write $arg1 $arg2 This shows the 1st argument becomes NULL and multiprobes are merged to 1 probe. Link: http://lkml.kernel.org/r/158779375766.6082.201939936008972838.stgit@devnote2 Cc: Ingo Molnar <[email protected]> Cc: [email protected] Fixes: 29a1548 ("tracing: Change trace_boot to use kprobe_event interface") Reviewed-by: Tom Zanussi <[email protected]> Signed-off-by: Masami Hiramatsu <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent dcbd21c commit da0f1f4

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

kernel/trace/trace_boot.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,24 +95,20 @@ trace_boot_add_kprobe_event(struct xbc_node *node, const char *event)
9595
struct xbc_node *anode;
9696
char buf[MAX_BUF_LEN];
9797
const char *val;
98-
int ret;
98+
int ret = 0;
9999

100-
kprobe_event_cmd_init(&cmd, buf, MAX_BUF_LEN);
100+
xbc_node_for_each_array_value(node, "probes", anode, val) {
101+
kprobe_event_cmd_init(&cmd, buf, MAX_BUF_LEN);
101102

102-
ret = kprobe_event_gen_cmd_start(&cmd, event, NULL);
103-
if (ret)
104-
return ret;
103+
ret = kprobe_event_gen_cmd_start(&cmd, event, val);
104+
if (ret)
105+
break;
105106

106-
xbc_node_for_each_array_value(node, "probes", anode, val) {
107-
ret = kprobe_event_add_field(&cmd, val);
107+
ret = kprobe_event_gen_cmd_end(&cmd);
108108
if (ret)
109-
return ret;
109+
pr_err("Failed to add probe: %s\n", buf);
110110
}
111111

112-
ret = kprobe_event_gen_cmd_end(&cmd);
113-
if (ret)
114-
pr_err("Failed to add probe: %s\n", buf);
115-
116112
return ret;
117113
}
118114
#else

0 commit comments

Comments
 (0)