From: Adrian Hunter Date: Wed, 9 Jan 2019 09:18:30 +0000 (+0200) Subject: perf tools: Fix split_kallsyms_for_kcore() for trampoline symbols X-Git-Tag: v4.19.31~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d8f691f29d9131d00610d1f8622e011b11e13319;p=platform%2Fkernel%2Flinux-rpi.git perf tools: Fix split_kallsyms_for_kcore() for trampoline symbols commit d6d457451eb94fa747dc202765592eb8885a7352 upstream. Kallsyms symbols do not have a size, so the size becomes the distance to the next symbol. Consequently the recently added trampoline symbols end up with large sizes because the trampolines are some distance from one another and the main kernel map. However, symbols that end outside their map can disrupt the symbol tree because, after mapping, it can appear incorrectly that they overlap other symbols. Add logic to truncate symbol size to the end of the corresponding map. Signed-off-by: Adrian Hunter Acked-by: Jiri Olsa Cc: stable@vger.kernel.org Fixes: d83212d5dd67 ("kallsyms, x86: Export addresses of PTI entry trampolines") Link: http://lkml.kernel.org/r/20190109091835.5570-2-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index d188b75..0715f97 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -709,6 +709,8 @@ static int map_groups__split_kallsyms_for_kcore(struct map_groups *kmaps, struct } pos->start -= curr_map->start - curr_map->pgoff; + if (pos->end > curr_map->end) + pos->end = curr_map->end; if (pos->end) pos->end -= curr_map->start - curr_map->pgoff; symbols__insert(&curr_map->dso->symbols, pos);