Patch "perf trace: avoid garbage when not printing a trace event's arguments" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    perf trace: avoid garbage when not printing a trace event's arguments

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-trace-avoid-garbage-when-not-printing-a-trace-e.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a6ab5a59d7393b95098521efad924aac6cef78ed
Author: Benjamin Peterson <benjamin@xxxxxxxxxxx>
Date:   Sun Nov 3 20:48:16 2024 +0000

    perf trace: avoid garbage when not printing a trace event's arguments
    
    [ Upstream commit 5fb8e56542a3cf469fdf25d77f50e21cbff3ae7e ]
    
    trace__fprintf_tp_fields may not print any tracepoint arguments. E.g., if the
    argument values are all zero. Previously, this would result in a totally
    uninitialized buffer being passed to fprintf, which could lead to garbage on the
    console. Fix the problem by passing the number of initialized bytes fprintf.
    
    Fixes: f11b2803bb88 ("perf trace: Allow choosing how to augment the tracepoint arguments")
    Signed-off-by: Benjamin Peterson <benjamin@xxxxxxxxxxx>
    Tested-by: Howard Chu <howardchu95@xxxxxxxxx>
    Tested-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20241103204816.7834-1-benjamin@xxxxxxxxxxx
    Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 93dab6423a048..9aafa332828f8 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2770,7 +2770,7 @@ static size_t trace__fprintf_tp_fields(struct trace *trace, struct evsel *evsel,
 		printed += syscall_arg_fmt__scnprintf_val(arg, bf + printed, size - printed, &syscall_arg, val);
 	}
 
-	return printed + fprintf(trace->output, "%s", bf);
+	return printed + fprintf(trace->output, "%.*s", (int)printed, bf);
 }
 
 static int trace__event_handler(struct trace *trace, struct evsel *evsel,




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux