summaryrefslogtreecommitdiffstats
path: root/tools/include
diff options
context:
space:
mode:
authorNumfor Mbiziwo-Tiapo <nums@google.com>2019-07-29 13:57:50 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2020-07-09 12:36:50 -0300
commitb39730a6633d630b2a7bc61e597a0c671eb753b4 (patch)
tree966d665d4ada45f93db54e19425682d564bf3307 /tools/include
parentc8f6ae1fb28d74ef7a0966477f61d1c2c8ee2e1e (diff)
downloadlinux-b39730a6633d630b2a7bc61e597a0c671eb753b4.tar.bz2
perf annotate: Fix non-null terminated buffer returned by readlink()
Our local MSAN (Memory Sanitizer) build of perf throws a warning that comes from the "dso__disassemble_filename" function in "tools/perf/util/annotate.c" when running perf record. The warning stems from the call to readlink, in which "build_id_path" was being read into "linkname". Since readlink does not null terminate, an uninitialized memory access would later occur when "linkname" is passed into the strstr function. This is simply fixed by null-terminating "linkname" after the call to readlink. To reproduce this warning, build perf by running: $ make -C tools/perf CLANG=1 CC=clang EXTRA_CFLAGS="-fsanitize=memory -fsanitize-memory-track-origins" (Additionally, llvm might have to be installed and clang might have to be specified as the compiler - export CC=/usr/bin/clang) Then running: tools/perf/perf record -o - ls / | tools/perf/perf --no-pager annotate -i - --stdio Please see the cover letter for why false positive warnings may be generated. Signed-off-by: Numfor Mbiziwo-Tiapo <nums@google.com> Acked-by: Ian Rogers <irogers@google.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Mark Drayton <mbd@fb.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Song Liu <songliubraving@fb.com> Cc: Stephane Eranian <eranian@google.com> Link: http://lore.kernel.org/lkml/20190729205750.193289-1-nums@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/include')
0 files changed, 0 insertions, 0 deletions