remarkable-linux/tools
Sandipan Das b4d84dcee9 perf report powerpc: Fix crash if callchain is empty
[ Upstream commit 143c99f6ac ]

For some cases, the callchain provided by the kernel may be empty. So,
the callchain ip filtering code will cause a crash if we do not check
whether the struct ip_callchain pointer is NULL before accessing any
members.

This can be observed on a powerpc64le system running Fedora 27 as shown
below.

  # perf record -b -e cycles:u ls

Before:

  # perf report --branch-history

  perf: Segmentation fault
  -------- backtrace --------
  perf[0x1027615c]
  linux-vdso64.so.1(__kernel_sigtramp_rt64+0x0)[0x7fff856304d8]
  perf(arch_skip_callchain_idx+0x44)[0x10257c58]
  perf[0x1017f2e4]
  perf(thread__resolve_callchain+0x124)[0x1017ff5c]
  perf(sample__resolve_callchain+0xf0)[0x10172788]
  ...

After:

  # perf report --branch-history

  Samples: 25  of event 'cycles:u', Event count (approx.): 2306870
    Overhead  Source:Line            Symbol                   Shared Object
  +   11.60%  _init+35736            [.] _init                ls
  +    9.84%  strcoll_l.c:137        [.] __strcoll_l          libc-2.26.so
  +    9.16%  memcpy.S:175           [.] __memcpy_power7      libc-2.26.so
  +    9.01%  gconv_charset.h:54     [.] _nl_find_locale      libc-2.26.so
  +    8.87%  dl-addr.c:52           [.] _dl_addr             libc-2.26.so
  +    8.83%  _init+236              [.] _init                ls
  ...

Reported-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
Acked-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20180611104049.11048-1-sandipan@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>
2018-08-24 13:09:06 +02:00
..
accounting
arch tools headers: Synchronise x86 cpufeatures.h for L1TF additions 2018-08-15 18:13:01 +02:00
build tools build: fix # escaping in .cmd files for future Make 2018-07-17 11:39:30 +02:00
cgroup
firewire
gpio tools/gpio: Fix build error with musl libc 2018-02-03 17:38:47 +01:00
hv tools: hv: fix compiler warnings about major/target_fname 2018-05-30 07:52:36 +02:00
iio
include tools: sync up .h files with the repective arch and uapi .h files 2018-05-30 12:19:59 +02:00
kvm/kvm_stat
laptop
leds
lib tools/lib/subcmd/pager.c: do not alias select() params 2018-05-01 12:58:25 -07:00
net bpf: fix uninitialized variable in bpf tools 2018-06-21 04:02:49 +09:00
nfsd
objtool Kbuild: fix # escaping in .cmd files for future Make 2018-07-11 16:29:21 +02:00
pci
pcmcia
perf perf report powerpc: Fix crash if callchain is empty 2018-08-24 13:09:06 +02:00
power cpupower : Fix cpupower working when cpu0 is offline 2018-02-03 17:38:55 +01:00
scripts Kbuild: fix # escaping in .cmd files for future Make 2018-07-11 16:29:21 +02:00
spi
testing selftests: bpf: notification about privilege required to run test_kmod.sh testing script 2018-08-24 13:09:04 +02:00
thermal/tmon tools/thermal: tmon: fix for segfault 2018-05-30 07:52:28 +02:00
time
usb usbip: dynamically allocate idev by nports found in sysfs 2018-08-03 07:50:26 +02:00
virtio
vm
Makefile