From: Greg Kroah-Hartman Date: Wed, 19 Jun 2019 12:35:10 +0000 (+0200) Subject: 4.14-stable patches X-Git-Tag: v5.1.13~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=820f2a6924db53f09201faf96ff0123b0f3778a8;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: perf-machine-guard-against-null-in-machine__exit.patch --- diff --git a/queue-4.14/perf-machine-guard-against-null-in-machine__exit.patch b/queue-4.14/perf-machine-guard-against-null-in-machine__exit.patch new file mode 100644 index 00000000000..7f54e4e52ab --- /dev/null +++ b/queue-4.14/perf-machine-guard-against-null-in-machine__exit.patch @@ -0,0 +1,62 @@ +From 4a2233b194c77ae1ea8304cb7c00b551de4313f0 Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Mon, 13 Nov 2017 16:06:29 -0300 +Subject: perf machine: Guard against NULL in machine__exit() + +From: Arnaldo Carvalho de Melo + +commit 4a2233b194c77ae1ea8304cb7c00b551de4313f0 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 +Cc: Alexander Shishkin +Cc: Andrei Vagin +Cc: David Ahern +Cc: Jiri Olsa +Cc: Namhyung Kim +Cc: Peter Zijlstra +Cc: Vasily Averin +Cc: Wang Nan +Fixes: 33974a414ce2 ("perf trace: Call machine__exit() at exit") +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Tommi Rantala +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/machine.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/tools/perf/util/machine.c ++++ b/tools/perf/util/machine.c +@@ -156,6 +156,9 @@ void machine__delete_threads(struct mach + + void machine__exit(struct machine *machine) + { ++ if (machine == NULL) ++ return; ++ + machine__destroy_kernel_maps(machine); + map_groups__exit(&machine->kmaps); + dsos__exit(&machine->dsos); diff --git a/queue-4.14/series b/queue-4.14/series new file mode 100644 index 00000000000..6e1e1c5c54e --- /dev/null +++ b/queue-4.14/series @@ -0,0 +1 @@ +perf-machine-guard-against-null-in-machine__exit.patch