[lkml]   [2018]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 4.18 139/235] perf tools: Fix maps__find_symbol_by_name()
4.18-stable review patch.  If anyone has any objections, please let me know.


From: Adrian Hunter <>

commit 03db8b583d1c3c84963e08e2abf6c79081da5c31 upstream.

Commit 1c5aae7710bb ("perf machine: Create maps for x86 PTI entry
trampolines") revealed a problem with maps__find_symbol_by_name() that
resulted in probes not being found e.g.

$ sudo perf probe xsk_mmap
xsk_mmap is out of .text, skip it.
Probe point 'xsk_mmap' not found.
Error: Failed to add events.

maps__find_symbol_by_name() can optionally return the map of the found
symbol. It can get the map wrong because, in fact, the symbol is found
on the map's dso, not allowing for the possibility that the dso has more
than one map. Fix by always checking the map contains the symbol.

Reported-by: Björn Töpel <>
Signed-off-by: Adrian Hunter <>
Tested-by: Björn Töpel <>
Cc: Jiri Olsa <>
Fixes: 1c5aae7710bb ("perf machine: Create maps for x86 PTI entry trampolines")
Signed-off-by: Arnaldo Carvalho de Melo <>
Signed-off-by: Greg Kroah-Hartman <>

tools/perf/util/map.c | 11 +++++++++++
1 file changed, 11 insertions(+)

--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -590,6 +590,13 @@ struct symbol *map_groups__find_symbol(s
return NULL;

+static bool map__contains_symbol(struct map *map, struct symbol *sym)
+ u64 ip = map->unmap_ip(map, sym->start);
+ return ip >= map->start && ip < map->end;
struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name,
struct map **mapp)
@@ -605,6 +612,10 @@ struct symbol *maps__find_symbol_by_name

if (sym == NULL)
+ if (!map__contains_symbol(pos, sym)) {
+ sym = NULL;
+ continue;
+ }
if (mapp != NULL)
*mapp = pos;
goto out;

 \ /
  Last update: 2018-09-24 14:39    [W:0.903 / U:1.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site