]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.31/perf-tools-fix-split_kallsyms_for_kcore-for-trampoline-symbols.patch
Linux 4.14.108
[thirdparty/kernel/stable-queue.git] / releases / 4.19.31 / perf-tools-fix-split_kallsyms_for_kcore-for-trampoline-symbols.patch
1 From d6d457451eb94fa747dc202765592eb8885a7352 Mon Sep 17 00:00:00 2001
2 From: Adrian Hunter <adrian.hunter@intel.com>
3 Date: Wed, 9 Jan 2019 11:18:30 +0200
4 Subject: perf tools: Fix split_kallsyms_for_kcore() for trampoline symbols
5
6 From: Adrian Hunter <adrian.hunter@intel.com>
7
8 commit d6d457451eb94fa747dc202765592eb8885a7352 upstream.
9
10 Kallsyms symbols do not have a size, so the size becomes the distance to
11 the next symbol.
12
13 Consequently the recently added trampoline symbols end up with large
14 sizes because the trampolines are some distance from one another and the
15 main kernel map.
16
17 However, symbols that end outside their map can disrupt the symbol tree
18 because, after mapping, it can appear incorrectly that they overlap
19 other symbols.
20
21 Add logic to truncate symbol size to the end of the corresponding map.
22
23 Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
24 Acked-by: Jiri Olsa <jolsa@kernel.org>
25 Cc: stable@vger.kernel.org
26 Fixes: d83212d5dd67 ("kallsyms, x86: Export addresses of PTI entry trampolines")
27 Link: http://lkml.kernel.org/r/20190109091835.5570-2-adrian.hunter@intel.com
28 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
29 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
30
31 ---
32 tools/perf/util/symbol.c | 2 ++
33 1 file changed, 2 insertions(+)
34
35 --- a/tools/perf/util/symbol.c
36 +++ b/tools/perf/util/symbol.c
37 @@ -709,6 +709,8 @@ static int map_groups__split_kallsyms_fo
38 }
39
40 pos->start -= curr_map->start - curr_map->pgoff;
41 + if (pos->end > curr_map->end)
42 + pos->end = curr_map->end;
43 if (pos->end)
44 pos->end -= curr_map->start - curr_map->pgoff;
45 symbols__insert(&curr_map->dso->symbols, pos);