Skip to content

Commit 77b91c1

Browse files
committed
perf machine: Fill map_symbol->maps in append_inlines() to fix segfault
I forgot to fill in the map_symbol->maps field in append_inlines() which then makes code down the line segfault when trying to deref it. It doesn't make any sense to have an addr_location with its 'map' member not NULL while its 'maps' is NULL, after all al->maps is where al->map is in. It is done that way so that we don't have to have in each 'struct map' a pointer to the 'struct maps' it is in, as we had in the past when we would have 'map->mg', before 'struct maps' was combined with 'struct map_groups', because there was always a one-to-one relationship for these structs. This fixes a segfault when processing DWARF callgraphs in 'perf report'. Reported-by: Jiri Olsa <jolsa@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Namhyung Kim <namhyung@kernel.org> Fixes: 08f6680 ("perf tools: Add a 'struct map_groups' pointer to 'struct map_symbol'") Link: http://lore.kernel.org/lkml/20191129160631.GD26963@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent fa7f7e7 commit 77b91c1

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎tools/perf/util/machine.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2446,6 +2446,7 @@ static int append_inlines(struct callchain_cursor *cursor, struct map_symbol *ms
24462446

24472447
list_for_each_entry(ilist, &inline_node->val, list) {
24482448
struct map_symbol ilist_ms = {
2449+
.maps = ms->maps,
24492450
.map = map,
24502451
.sym = ilist->symbol,
24512452
};

0 commit comments

Comments
 (0)