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
6 From: Adrian Hunter <adrian.hunter@intel.com>
8 commit d6d457451eb94fa747dc202765592eb8885a7352 upstream.
10 Kallsyms symbols do not have a size, so the size becomes the distance to
13 Consequently the recently added trampoline symbols end up with large
14 sizes because the trampolines are some distance from one another and the
17 However, symbols that end outside their map can disrupt the symbol tree
18 because, after mapping, it can appear incorrectly that they overlap
21 Add logic to truncate symbol size to the end of the corresponding map.
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>
32 tools/perf/util/symbol.c | 2 ++
33 1 file changed, 2 insertions(+)
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
40 pos->start -= curr_map->start - curr_map->pgoff;
41 + if (pos->end > curr_map->end)
42 + pos->end = curr_map->end;
44 pos->end -= curr_map->start - curr_map->pgoff;
45 symbols__insert(&curr_map->dso->symbols, pos);