1 From 66e96c25d02945347952a61abe52a15b0e9a626b Mon Sep 17 00:00:00 2001
2 From: Changbin Du <changbin.du@gmail.com>
3 Date: Sat, 16 Mar 2019 16:05:50 +0800
4 Subject: perf map: Remove map from 'names' tree in __maps__remove()
6 [ Upstream commit b49265e04410b97b31a5ee66ef6782c1b2d6cd2c ]
8 There are two trees for each map inserted by maps__insert(), so remove
9 it from the 'names' tree in __maps__remove().
11 Detected with gcc's ASan.
13 Signed-off-by: Changbin Du <changbin.du@gmail.com>
14 Reviewed-by: Jiri Olsa <jolsa@kernel.org>
15 Cc: Alexei Starovoitov <ast@kernel.org>
16 Cc: Daniel Borkmann <daniel@iogearbox.net>
17 Cc: Eric Saint-Etienne <eric.saint.etienne@oracle.com>
18 Cc: Namhyung Kim <namhyung@kernel.org>
19 Cc: Peter Zijlstra <peterz@infradead.org>
20 Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
21 Fixes: 1e6285699b30 ("perf symbols: Fix slowness due to -ffunction-section")
22 Link: http://lkml.kernel.org/r/20190316080556.3075-11-changbin.du@gmail.com
23 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
24 Signed-off-by: Sasha Levin <sashal@kernel.org>
26 tools/perf/util/map.c | 3 +++
27 1 file changed, 3 insertions(+)
29 diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
30 index 6751301a755c..750ecc3dad50 100644
31 --- a/tools/perf/util/map.c
32 +++ b/tools/perf/util/map.c
33 @@ -911,6 +911,9 @@ static void __maps__remove(struct maps *maps, struct map *map)
35 rb_erase_init(&map->rb_node, &maps->entries);
38 + rb_erase_init(&map->rb_node_name, &maps->names);
42 void maps__remove(struct maps *maps, struct map *map)