• Arnaldo Carvalho de Melo's avatar
    perf machine: Guard against NULL in machine__exit() · 4a2233b1
    Arnaldo Carvalho de Melo authored
    A recent fix for 'perf trace' introduced a bug where
    machine__exit(trace->host) could be called while trace->host was still
    NULL, so make this more robust by guarding against NULL, just like
    free() does.
    
    The problem happens, for instance, when !root users try to run 'perf
    trace':
    
      [acme@jouet linux]$ trace
      Error:	No permissions to read /sys/kernel/debug/tracing/events/raw_syscalls/sys_(enter|exit)
      Hint:	Try 'sudo mount -o remount,mode=755 /sys/kernel/debug/tracing'
    
      perf: Segmentation fault
      Obtained 7 stack frames.
      [0x4f1b2e]
      /lib64/libc.so.6(+0x3671f) [0x7f43a1dd971f]
      [0x4f3fec]
      [0x47468b]
      [0x42a2db]
      /lib64/libc.so.6(__libc_start_main+0xe9) [0x7f43a1dc3509]
      [0x42a6c9]
      Segmentation fault (core dumped)
      [acme@jouet linux]$
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Andrei Vagin <avagin@openvz.org>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Vasily Averin <vvs@virtuozzo.com>
    Cc: Wang Nan <wangnan0@huawei.com>
    Fixes: 33974a41 ("perf trace: Call machine__exit() at exit")
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    4a2233b1
Name
Last commit
Last update
..
accounting Loading commit data...
arch Loading commit data...
build Loading commit data...
cgroup Loading commit data...
firewire Loading commit data...
gpio Loading commit data...
hv Loading commit data...
iio Loading commit data...
include Loading commit data...
kvm/kvm_stat Loading commit data...
laptop Loading commit data...
leds Loading commit data...
lib Loading commit data...
net Loading commit data...
nfsd Loading commit data...
objtool Loading commit data...
pci Loading commit data...
pcmcia Loading commit data...
perf Loading commit data...
power Loading commit data...
scripts Loading commit data...
spi Loading commit data...
testing Loading commit data...
thermal/tmon Loading commit data...
time Loading commit data...
usb Loading commit data...
virtio Loading commit data...
vm Loading commit data...
Makefile Loading commit data...