Skip to content

Commit 56e6a34

Browse files
committed
Merge tag 'trace-v6.13-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull tracing fix from Steven Rostedt: "Fix trace event string check when dealing with array of strings The xe_bo_move event has a field that indexes into an array of strings. The TP_fast_assign() added the index into the ring buffer and the TP_printk() had a "%s" that referenced the array using the index in the ring buffer. This is a legitimate use of "%s" in trace events. But this triggered a false positive in the test_event_printk() at boot saying that the string was dangerous. Change the check to allow arrays using fields in the ring buffer as an index to be considered a safe string" * tag 'trace-v6.13-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: tracing: Have process_string() also allow arrays
2 parents ccb98cc + afc6717 commit 56e6a34

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

kernel/trace/trace_events.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,18 @@ static bool process_string(const char *fmt, int len, struct trace_event_call *ca
364364
s = r + 1;
365365
} while (s < e);
366366

367+
/*
368+
* Check for arrays. If the argument has: foo[REC->val]
369+
* then it is very likely that foo is an array of strings
370+
* that are safe to use.
371+
*/
372+
r = strstr(s, "[");
373+
if (r && r < e) {
374+
r = strstr(r, "REC->");
375+
if (r && r < e)
376+
return true;
377+
}
378+
367379
/*
368380
* If there's any strings in the argument consider this arg OK as it
369381
* could be: REC->field ? "foo" : "bar" and we don't want to get into

0 commit comments

Comments
 (0)