]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.19.31/perf-tools-fix-split_kallsyms_for_kcore-for-trampoline-symbols.patch
Linux 4.19.31
[thirdparty/kernel/stable-queue.git] / releases / 4.19.31 / perf-tools-fix-split_kallsyms_for_kcore-for-trampoline-symbols.patch
CommitLineData
77e25528
GKH
1From d6d457451eb94fa747dc202765592eb8885a7352 Mon Sep 17 00:00:00 2001
2From: Adrian Hunter <adrian.hunter@intel.com>
3Date: Wed, 9 Jan 2019 11:18:30 +0200
4Subject: perf tools: Fix split_kallsyms_for_kcore() for trampoline symbols
5
6From: Adrian Hunter <adrian.hunter@intel.com>
7
8commit d6d457451eb94fa747dc202765592eb8885a7352 upstream.
9
10Kallsyms symbols do not have a size, so the size becomes the distance to
11the next symbol.
12
13Consequently the recently added trampoline symbols end up with large
14sizes because the trampolines are some distance from one another and the
15main kernel map.
16
17However, symbols that end outside their map can disrupt the symbol tree
18because, after mapping, it can appear incorrectly that they overlap
19other symbols.
20
21Add logic to truncate symbol size to the end of the corresponding map.
22
23Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
24Acked-by: Jiri Olsa <jolsa@kernel.org>
25Cc: stable@vger.kernel.org
26Fixes: d83212d5dd67 ("kallsyms, x86: Export addresses of PTI entry trampolines")
27Link: http://lkml.kernel.org/r/20190109091835.5570-2-adrian.hunter@intel.com
28Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
29Signed-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);