android_kernel_sony_sdm845/tools/perf
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Leo Yan 32943db387 perf session: Correct buffer copying when peeking events
[ Upstream commit 197eecb6ecae0b04bd694432f640ff75597fed9c ]

When peeking an event, it has a short path and a long path.  The short
path uses the session pointer "one_mmap_addr" to directly fetch the
event; and the long path needs to read out the event header and the
following event data from file and fill into the buffer pointer passed
through the argument "buf".

The issue is in the long path that it copies the event header and event
data into the same destination address which pointer "buf", this means
the event header is overwritten.  We are just lucky to run into the
short path in most cases, so we don't hit the issue in the long path.

This patch adds the offset "hdr_sz" to the pointer "buf" when copying
the event data, so that it can reserve the event header which can be
used properly by its caller.

Fixes: 5a52f33adf ("perf session: Add perf_session__peek_event()")
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20210605052957.1070720-1-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-06-16 11:36:35 +02:00
..
arch perf record: Fix module size on s390 2019-08-25 10:51:21 +02:00
bench perf bench numa: Fix cpu0 binding 2019-09-06 10:19:33 +02:00
Documentation perf record/stat: Explicitly call out event modifiers in the documentation 2020-09-12 11:47:32 +02:00
jvmti
pmu-events perf jevents: Fix getting maximum number of fds 2021-06-03 08:23:31 +02:00
python tweewide: Fix most Shebang lines 2021-06-03 08:23:27 +02:00
scripts tweewide: Fix most Shebang lines 2021-06-03 08:23:27 +02:00
tests perf test: Fix unaligned access in sample parsing test 2021-03-03 17:44:39 +01:00
trace
ui perf hists browser: Restore ESC as "Zoom out" of DSO/thread/etc 2020-03-11 07:53:08 +01:00
util perf session: Correct buffer copying when peeking events 2021-06-16 11:36:35 +02:00
.gitignore
Build
builtin-annotate.c
builtin-bench.c
builtin-buildid-cache.c
builtin-buildid-list.c
builtin-config.c
builtin-data.c
builtin-diff.c
builtin-evlist.c
builtin-help.c perf help: Remove needless use of strncpy() 2019-07-10 09:55:36 +02:00
builtin-inject.c
builtin-kmem.c perf kmem: Fix memory leak in compact_gfp_flags() 2019-11-10 11:23:16 +01:00
builtin-kvm.c
builtin-list.c
builtin-lock.c perf lock: Don't free "lock_seq_stat" if read_count isn't zero 2020-11-24 13:03:02 +01:00
builtin-mem.c
builtin-probe.c perf probe: Do not show the skipped events 2020-06-20 10:24:22 +02:00
builtin-record.c
builtin-report.c perf report: Fix NULL pointer dereference in hists__fprintf_nr_sample_events() 2020-06-30 15:38:30 -04:00
builtin-sched.c
builtin-script.c perf tools: Fix snprint warnings for gcc 8 2020-07-31 16:44:07 +02:00
builtin-stat.c perf stat: Reset previous counts on repeat with interval 2019-10-17 13:42:17 -07:00
builtin-timechart.c
builtin-top.c perf top: Fix stdio interface input handling with glibc 2.28+ 2020-10-14 09:48:15 +02:00
builtin-trace.c perf trace: Add mmap alias for s390 2018-04-13 19:48:17 +02:00
builtin-version.c
builtin.h
check-headers.sh tools include: Adopt linux/bits.h 2019-05-31 06:48:13 -07:00
command-list.txt
CREDITS
design.txt
Makefile tools: Let O= makes handle a relative path with -C option 2020-04-02 17:20:36 +02:00
Makefile.config perf tools: Fix build with ARCH=x86_64 2018-01-23 19:57:07 +01:00
Makefile.perf perf tools: Move headers check into bash script 2018-06-05 10:28:56 +02:00
MANIFEST tools include: Introduce linux/bug.h, from the kernel sources 2018-06-05 10:28:56 +02:00
perf-archive.sh
perf-completion.sh
perf-read-vdso.c
perf-sys.h
perf-with-kcore.sh
perf.c
perf.h perf tools: Increase MAX_NR_CPUS and MAX_CACHES 2019-08-04 09:33:22 +02:00