aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python/sched-migration.py
diff options
context:
space:
mode:
authorMarcin Slusarz <[email protected]>2010-07-27 23:18:01 +0000
committerSteven Rostedt <[email protected]>2010-08-13 19:23:16 +0000
commit1aa54bca6ee0d07ebcafb8ca8074b624d80724aa (patch)
tree815f3c1d184b61958ee48eb868ed28b1e5aab278 /tools/perf/scripts/python/sched-migration.py
parenttracing/events: Convert format output to seq_file (diff)
downloadkernel-1aa54bca6ee0d07ebcafb8ca8074b624d80724aa.tar.gz
kernel-1aa54bca6ee0d07ebcafb8ca8074b624d80724aa.zip
tracing: Sanitize value returned from write(trace_marker, "...", len)
When userspace code writes non-new-line-terminated string to trace_marker file, write handler appends new-line and returns number of bytes written to trace buffer, so write(fd, "abc", 3) will return 4 That's unexpected and unfortunately it confuses glibc's fprintf function. Example: int main() { fprintf(stderr, "abc"); return 0; } $ gcc test.c -o test $ echo mmiotrace > /sys/kernel/debug/tracing/current_tracer $ ./test 2>/sys/kernel/debug/tracing/trace_marker results in infinite loop: write(fd, "abc", 3) = 4 write(fd, "", 1) = 0 write(fd, "", 1) = 0 write(fd, "", 1) = 0 write(fd, "", 1) = 0 write(fd, "", 1) = 0 write(fd, "", 1) = 0 write(fd, "", 1) = 0 (...) ...and kernel trace buffer full of empty markers. Fix it by sanitizing write return value. Signed-off-by: Marcin Slusarz <[email protected]> LKML-Reference: <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/sched-migration.py')
0 files changed, 0 insertions, 0 deletions