Skip to content

Commit ce51e61

Browse files
committed
tracing: fprobe-event: Fix to check tracepoint event and return
Fix to check the tracepoint event is not valid with $retval. The commit 08c9306 ("tracing/fprobe-event: Assume fprobe is a return event by $retval") introduced automatic return probe conversion with $retval. But since tracepoint event does not support return probe, $retval is not acceptable. Without this fix, ftracetest, tprobe_syntax_errors.tc fails; [22] Tracepoint probe event parser error log check [FAIL] ---- # tail 22-tprobe_syntax_errors.tc-log.mRKroL + ftrace_errlog_check trace_fprobe t kfree ^$retval dynamic_events + printf %s t kfree + wc -c + pos=8 + printf %s t kfree ^$retval + tr -d ^ + command=t kfree $retval + echo Test command: t kfree $retval Test command: t kfree $retval + echo ---- So 't kfree $retval' should fail (tracepoint doesn't support return probe) but passed it. Link: https://lore.kernel.org/all/169944555933.45057.12831706585287704173.stgit@devnote2/ Fixes: 08c9306 ("tracing/fprobe-event: Assume fprobe is a return event by $retval") Cc: [email protected] Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
1 parent abc2846 commit ce51e61

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

kernel/trace/trace_fprobe.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -927,11 +927,12 @@ static int parse_symbol_and_return(int argc, const char *argv[],
927927
for (i = 2; i < argc; i++) {
928928
tmp = strstr(argv[i], "$retval");
929929
if (tmp && !isalnum(tmp[7]) && tmp[7] != '_') {
930+
if (is_tracepoint) {
931+
trace_probe_log_set_index(i);
932+
trace_probe_log_err(tmp - argv[i], RETVAL_ON_PROBE);
933+
return -EINVAL;
934+
}
930935
*is_return = true;
931-
/*
932-
* NOTE: Don't check is_tracepoint here, because it will
933-
* be checked when the argument is parsed.
934-
*/
935936
break;
936937
}
937938
}

0 commit comments

Comments
 (0)