linux-stable/tools/perf
Arnaldo Carvalho de Melo 24f13636ad perf machine: Guard against NULL in machine__exit()
commit 4a2233b194 upstream.

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: 33974a414c ("perf trace: Call machine__exit() at exit")
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-22 08:16:14 +02:00
..
Documentation perf config: Fix an error in the config template documentation 2019-04-20 09:15:02 +02:00
arch perf tools: Fix compile error with libunwind x86 2019-03-19 13:13:21 +01:00
bench perf bench numa: Add define for RUSAGE_THREAD if not present 2019-05-25 18:25:36 +02:00
jvmti perf tools: Fix undefined symbol scnprintf in libperf-jvmti.so 2018-11-27 16:10:49 +01:00
pmu-events perf vendor events intel: Fix wrong filter_band* values for uncore events 2018-11-13 11:14:50 -08:00
python License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
scripts perf script python: Fix export-to-sqlite.py sample columns 2018-10-18 09:16:23 +02:00
tests perf tests: Fix a memory leak in test__perf_evsel__tp_sched_test() 2019-04-20 09:15:02 +02:00
trace License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ui perf report: Fix wrong jump arrow 2018-05-30 07:52:40 +02:00
util perf machine: Guard against NULL in machine__exit() 2019-06-22 08:16:14 +02:00
.gitignore perf tools: Add trace/beauty/generated/ into .gitignore 2018-05-30 12:19:59 +02:00
Build perf trace: Only build tools/perf/trace/beauty/ when building 'perf trace' 2017-07-18 23:13:52 -03:00
CREDITS
MANIFEST perf tools: Get all of tools/{arch,include}/ in the MANIFEST 2017-09-25 10:39:43 -03:00
Makefile perf tools: Disable parallelism for 'make clean' 2018-11-04 14:52:48 +01:00
Makefile.config perf tools: Fix use of alternatives to find JDIR 2018-11-13 11:14:51 -08:00
Makefile.perf tools: fix cross-compile var clobbering 2019-01-13 10:01:02 +01:00
builtin-annotate.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
builtin-bench.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
builtin-buildid-cache.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
builtin-buildid-list.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
builtin-c2c.c perf c2c: Fix c2c report for empty numa node 2019-04-05 22:31:27 +02:00
builtin-config.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
builtin-data.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
builtin-diff.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
builtin-evlist.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
builtin-ftrace.c tools include: Adopt strstarts() from the kernel 2017-07-20 15:46:10 -03:00
builtin-help.c perf help: Fix a bug during strstart() conversion 2018-02-25 11:07:54 +01:00
builtin-inject.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
builtin-kallsyms.c perf tools: Including missing inttypes.h header 2017-04-19 13:01:46 -03:00
builtin-kmem.c kmemcheck: remove whats left of NOTRACK flags 2018-02-22 15:42:23 +01:00
builtin-kvm.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
builtin-list.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
builtin-lock.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
builtin-mem.c perf tools: Fix leaking rec_argv in error cases 2017-12-10 13:40:43 +01:00
builtin-probe.c perf buildid-cache: Support binary objects from other namespaces 2017-07-18 23:14:11 -03:00
builtin-record.c perf record: Synthesize features before events in pipe mode 2018-12-29 13:39:08 +01:00
builtin-report.c perf unwind: Do not look just at the global callchain_param.record_mode 2018-04-26 11:02:06 +02:00
builtin-sched.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
builtin-script.c perf tools: Fix snprint warnings for gcc 8 2018-10-18 09:16:28 +02:00
builtin-stat.c perf stat: Fix core dump when flag T is used 2018-05-30 07:52:31 +02:00
builtin-timechart.c perf tools: Fix leaking rec_argv in error cases 2017-12-10 13:40:43 +01:00
builtin-top.c perf top: Fix error handling in cmd_top() 2019-04-20 09:15:02 +02:00
builtin-trace.c perf trace: Support multiple "vfs_getname" probes 2019-03-13 14:03:21 -07:00
builtin-version.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
builtin.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
check-headers.sh tools include: Adopt linux/bits.h 2019-04-27 09:35:41 +02:00
command-list.txt perf tools: Missing c2c command in command-list 2017-03-13 10:59:31 -03:00
design.txt
perf-archive.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf-completion.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf-read-vdso.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf-sys.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf-with-kcore.sh
perf.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf.h perf tools: Allow overriding MAX_NR_CPUS at compile time 2018-09-19 22:43:40 +02:00