Skip to content

Commit db5e228

Browse files
committed
tracing: fprobe-events: Log error for exceeding the number of entry args
Add error message when the number of entry argument exceeds the maximum size of entry data. This is currently checked when registering fprobe, but in this case no error message is shown in the error_log file. Link: https://lore.kernel.org/all/174055074269.4079315.17809232650360988538.stgit@mhiramat.tok.corp.google.com/ Fixes: 25f00e4 ("tracing/probes: Support $argN in return probe (kprobe and fprobe)") Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent d045365 commit db5e228

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

kernel/trace/trace_fprobe.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,11 @@ static int trace_fprobe_create_internal(int argc, const char *argv[],
12301230
if (is_return && tf->tp.entry_arg) {
12311231
tf->fp.entry_handler = trace_fprobe_entry_handler;
12321232
tf->fp.entry_data_size = traceprobe_get_entry_data_size(&tf->tp);
1233+
if (ALIGN(tf->fp.entry_data_size, sizeof(long)) > MAX_FPROBE_DATA_SIZE) {
1234+
trace_probe_log_set_index(2);
1235+
trace_probe_log_err(0, TOO_MANY_EARGS);
1236+
return -E2BIG;
1237+
}
12331238
}
12341239

12351240
ret = traceprobe_set_print_fmt(&tf->tp,

kernel/trace/trace_probe.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,8 @@ extern int traceprobe_define_arg_fields(struct trace_event_call *event_call,
545545
C(NO_BTF_FIELD, "This field is not found."), \
546546
C(BAD_BTF_TID, "Failed to get BTF type info."),\
547547
C(BAD_TYPE4STR, "This type does not fit for string."),\
548-
C(NEED_STRING_TYPE, "$comm and immediate-string only accepts string type"),
548+
C(NEED_STRING_TYPE, "$comm and immediate-string only accepts string type"),\
549+
C(TOO_MANY_EARGS, "Too many entry arguments specified"),
549550

550551
#undef C
551552
#define C(a, b) TP_ERR_##a

0 commit comments

Comments
 (0)