diff options
author | Stephane Eranian <eranian@google.com> | 2012-03-13 16:51:02 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2012-03-13 17:01:28 +0100 |
commit | 8aa8a7c80ccdfac2df5ee48a51a4a7bee2143d4f (patch) | |
tree | 605e7196aa1c53aece78e3dfc897c7030e53af14 /ipc | |
parent | 87e24f4b67e68d9fd8df16e0bf9c66d1ad2a2533 (diff) | |
download | blackbird-op-linux-8aa8a7c80ccdfac2df5ee48a51a4a7bee2143d4f.tar.gz blackbird-op-linux-8aa8a7c80ccdfac2df5ee48a51a4a7bee2143d4f.zip |
perf record: Fix buffer overrun bug in tracepoint_id_to_path()
This patch fixes a buffer overrun bug in
tracepoint_id_to_path(). The bug manisfested itself as a memory
error reported by perf record. I ran into it with perf sched:
$ perf sched rec noploop 2 noploop for 2 seconds
[ perf record: Woken up 14 times to write data ]
[ perf record: Captured and wrote 42.701 MB perf.data (~1865622 samples) ]
Fatal: No memory to alloc tracepoints list
It turned out that tracepoint_id_to_path() was reading the
tracepoint id using read() but the buffer was not large enough
to include the \n terminator for id with 4 digits or more.
The patch fixes the problem by extending the buffer to a more
reasonable size covering all possible id length include \n
terminator. Note that atoll() stops at the first non digit
character, thus it is not necessary to clear the buffer between
each read.
Signed-off-by: Stephane Eranian <eranian@google.com>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: fweisbec@gmail.com
Cc: dsahern@gmail.com
Link: http://lkml.kernel.org/r/20120313155102.GA6465@quad
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'ipc')
0 files changed, 0 insertions, 0 deletions