aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-09-30 12:29:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-09-30 12:29:53 -0400
commitcf4f493b102399adea3cf65cdde7161c17fb605c (patch)
treeb3ae5844c4bc69e1428a9ed4db7c01ad786bce43 /kernel
parentc710364f78afdef8c2ed07556d0743c5a30ed429 (diff)
parent8ed4889eb83179dbc9a105cfed65cc42ecb61097 (diff)
Merge tag 'trace-v5.4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing fixes from Steven Rostedt: "A few more tracing fixes: - Fix a buffer overflow by checking nr_args correctly in probes - Fix a warning that is reported by clang - Fix a possible memory leak in error path of filter processing - Fix the selftest that checks for failures, but wasn't failing - Minor clean up on call site output of a memory trace event" * tag 'trace-v5.4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: selftests/ftrace: Fix same probe error test mm, tracing: Print symbol name for call_site in trace events tracing: Have error path in predicate_parse() free its allocated memory tracing: Fix clang -Wint-in-bool-context warnings in IF_ASSIGN macro tracing/probe: Fix to check the difference of nr_args before adding probe
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace.h10
-rw-r--r--kernel/trace/trace_events_filter.c6
-rw-r--r--kernel/trace/trace_probe.c16
3 files changed, 25 insertions, 7 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 26b0a08f3c7d..f801d154ff6a 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -365,11 +365,11 @@ static inline struct trace_array *top_trace_array(void)
365 __builtin_types_compatible_p(typeof(var), type *) 365 __builtin_types_compatible_p(typeof(var), type *)
366 366
367#undef IF_ASSIGN 367#undef IF_ASSIGN
368#define IF_ASSIGN(var, entry, etype, id) \ 368#define IF_ASSIGN(var, entry, etype, id) \
369 if (FTRACE_CMP_TYPE(var, etype)) { \ 369 if (FTRACE_CMP_TYPE(var, etype)) { \
370 var = (typeof(var))(entry); \ 370 var = (typeof(var))(entry); \
371 WARN_ON(id && (entry)->type != id); \ 371 WARN_ON(id != 0 && (entry)->type != id); \
372 break; \ 372 break; \
373 } 373 }
374 374
375/* Will cause compile errors if type is not found. */ 375/* Will cause compile errors if type is not found. */
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index c773b8fb270c..c9a74f82b14a 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -452,8 +452,10 @@ predicate_parse(const char *str, int nr_parens, int nr_preds,
452 452
453 switch (*next) { 453 switch (*next) {
454 case '(': /* #2 */ 454 case '(': /* #2 */
455 if (top - op_stack > nr_parens) 455 if (top - op_stack > nr_parens) {
456 return ERR_PTR(-EINVAL); 456 ret = -EINVAL;
457 goto out_free;
458 }
457 *(++top) = invert; 459 *(++top) = invert;
458 continue; 460 continue;
459 case '!': /* #3 */ 461 case '!': /* #3 */
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index baf58a3612c0..905b10af5d5c 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -178,6 +178,16 @@ void __trace_probe_log_err(int offset, int err_type)
178 if (!command) 178 if (!command)
179 return; 179 return;
180 180
181 if (trace_probe_log.index >= trace_probe_log.argc) {
182 /**
183 * Set the error position is next to the last arg + space.
184 * Note that len includes the terminal null and the cursor
185 * appaers at pos + 1.
186 */
187 pos = len;
188 offset = 0;
189 }
190
181 /* And make a command string from argv array */ 191 /* And make a command string from argv array */
182 p = command; 192 p = command;
183 for (i = 0; i < trace_probe_log.argc; i++) { 193 for (i = 0; i < trace_probe_log.argc; i++) {
@@ -1084,6 +1094,12 @@ int trace_probe_compare_arg_type(struct trace_probe *a, struct trace_probe *b)
1084{ 1094{
1085 int i; 1095 int i;
1086 1096
1097 /* In case of more arguments */
1098 if (a->nr_args < b->nr_args)
1099 return a->nr_args + 1;
1100 if (a->nr_args > b->nr_args)
1101 return b->nr_args + 1;
1102
1087 for (i = 0; i < a->nr_args; i++) { 1103 for (i = 0; i < a->nr_args; i++) {
1088 if ((b->nr_args <= i) || 1104 if ((b->nr_args <= i) ||
1089 ((a->args[i].type != b->args[i].type) || 1105 ((a->args[i].type != b->args[i].type) ||