Skip to content

Commit bdf9de5

Browse files
mhiramatgregkh
authored andcommitted
tracing/probes: Prevent out-of-bounds write in __trace_probe_log_err()
commit a9d6fb2 upstream. If trace_probe_log.argc is 0 in __trace_probe_log_err(), the loop constructing the command string will not execute and p will remain equal to command. Writing to *(p - 1) will cause an out-of-bounds access before command. This should not happen, but better to be treated. Reject if trace_probe_log.argc is 0. Link: https://lore.kernel.org/all/178454233992.290363.18323091580600697731.stgit@devnote2/ Fixes: ab105a4 ("tracing: Use tracing error_log with probe events") Cc: stable@vger.kernel.org Assisted-by: Antigravity:gemini-3.5-flash Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent da0a33d commit bdf9de5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

kernel/trace/trace_probe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ void __trace_probe_log_err(int offset, int err_type)
186186

187187
lockdep_assert_held(&dyn_event_ops_mutex);
188188

189-
if (!trace_probe_log.argv)
189+
if (!trace_probe_log.argv || !trace_probe_log.argc)
190190
return;
191191

192192
/* Recalculate the length and allocate buffer */

0 commit comments

Comments
 (0)