diff options
author | Namhyung Kim <namhyung@kernel.org> | 2022-09-10 01:50:24 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2022-10-04 13:55:22 +0200 |
commit | d031a00a29b2b2a6ad99c41fadb1ea3c0dc5046c (patch) | |
tree | a99ab14a80ef3c1ec19c9ecd6137f043dfc1332f /tools/perf/builtin-annotate.c | |
parent | perf top: Fix error code in cmd_top() (diff) | |
download | linux-d031a00a29b2b2a6ad99c41fadb1ea3c0dc5046c.tar.xz linux-d031a00a29b2b2a6ad99c41fadb1ea3c0dc5046c.zip |
perf record: Fix a segfault in record__read_lost_samples()
When it fails to open events record__open() returns without setting the
session->evlist. Then it gets a segfault in the function trying to read
lost sample counts. You can easily reproduce it as a normal user like:
$ perf record -p 1 true
...
perf: Segmentation fault
...
Skip the function if it has no evlist. And add more protection for evsels
which are not properly initialized.
Fixes: a49aa8a54e861af1 ("perf record: Read and inject LOST_SAMPLES events")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Leo Yan <leo.yan@linaro.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20220909235024.278281-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-annotate.c')
0 files changed, 0 insertions, 0 deletions