]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
perf tools: Fix crash caused by accessing feat_ops[HEADER_LAST_FEATURE]
authorRavi Bangoria <ravi.bangoria@linux.ibm.com>
Mon, 25 Jun 2018 12:42:20 +0000 (18:12 +0530)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:44:04 +0000 (19:44 -0600)
commit3353453b77500702f415ba78ad27b58aca290c38
tree21bfb9c681cdbdc76e62f80603a4a64b1672c1b9
parent1bb802168fdbbcd72386cb67a5f4ece140283797
perf tools: Fix crash caused by accessing feat_ops[HEADER_LAST_FEATURE]

BugLink: https://bugs.launchpad.net/bugs/1835845
[ Upstream commit 92ead7ee30c80f8852d28735cbcb9d79bc85f715 ]

perf_event__process_feature() accesses feat_ops[HEADER_LAST_FEATURE]
which is not defined and thus perf is crashing. HEADER_LAST_FEATURE is
used as an end marker for the perf report but it's unused for perf
script/annotate. Ignore HEADER_LAST_FEATURE for perf script/annotate,
just like it is done in 'perf report'.

Before:
  # perf record -o - ls | perf script
  <SNIP 'ls' output>
  Segmentation fault (core dumped)
  #

After:
  # perf record -o - ls | perf script
  <SNIP 'ls' output>
  Segmentation fault (core dumped)
  ls 7031 4392.099856:  250000 cpu-clock:uhH:  7f5e0ce7cd60
  ls 7031 4392.100355:  250000 cpu-clock:uhH:  7f5e0c706ef7
  #

Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: David Carrillo-Cisneros <davidcc@google.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Fixes: 57b5de463925 ("perf report: Support forced leader feature in pipe mode")
Link: http://lkml.kernel.org/r/20180625124220.6434-4-ravi.bangoria@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
tools/perf/builtin-annotate.c
tools/perf/builtin-script.c
tools/perf/util/header.c