]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.14/perf-probe-fix-getting-the-kernel-map.patch
Linux 4.9.166
[thirdparty/kernel/stable-queue.git] / queue-4.14 / perf-probe-fix-getting-the-kernel-map.patch
1 From eaeffeb9838a7c0dec981d258666bfcc0fa6a947 Mon Sep 17 00:00:00 2001
2 From: Adrian Hunter <adrian.hunter@intel.com>
3 Date: Mon, 4 Mar 2019 15:13:21 +0200
4 Subject: perf probe: Fix getting the kernel map
5
6 From: Adrian Hunter <adrian.hunter@intel.com>
7
8 commit eaeffeb9838a7c0dec981d258666bfcc0fa6a947 upstream.
9
10 Since commit 4d99e4136580 ("perf machine: Workaround missing maps for
11 x86 PTI entry trampolines"), perf tools has been creating more than one
12 kernel map, however 'perf probe' assumed there could be only one.
13
14 Fix by using machine__kernel_map() to get the main kernel map.
15
16 Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
17 Tested-by: Joseph Qi <joseph.qi@linux.alibaba.com>
18 Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
19 Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
20 Cc: Andy Lutomirski <luto@kernel.org>
21 Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 Cc: Jiufei Xue <jiufei.xue@linux.alibaba.com>
23 Cc: Peter Zijlstra <peterz@infradead.org>
24 Cc: stable@vger.kernel.org
25 Cc: Xu Yu <xuyu@linux.alibaba.com>
26 Fixes: 4d99e4136580 ("perf machine: Workaround missing maps for x86 PTI entry trampolines")
27 Fixes: d83212d5dd67 ("kallsyms, x86: Export addresses of PTI entry trampolines")
28 Link: http://lkml.kernel.org/r/2ed432de-e904-85d2-5c36-5897ddc5b23b@intel.com
29 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
30 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
31
32 ---
33 tools/perf/util/probe-event.c | 6 ++++--
34 1 file changed, 4 insertions(+), 2 deletions(-)
35
36 --- a/tools/perf/util/probe-event.c
37 +++ b/tools/perf/util/probe-event.c
38 @@ -169,8 +169,10 @@ static struct map *kernel_get_module_map
39 if (module && strchr(module, '/'))
40 return dso__new_map(module);
41
42 - if (!module)
43 - module = "kernel";
44 + if (!module) {
45 + pos = machine__kernel_map(host_machine);
46 + return map__get(pos);
47 + }
48
49 for (pos = maps__first(maps); pos; pos = map__next(pos)) {
50 /* short_name is "[module]" */