Files
linux/tools/perf/util
Casey Chen 4c17736689 perf tool: fix dereferencing NULL al->maps
With 0dd5041c9a ("perf addr_location: Add init/exit/copy functions"),
when cpumode is 3 (macro PERF_RECORD_MISC_HYPERVISOR),
thread__find_map() could return with al->maps being NULL.

The path below could add a callchain_cursor_node with NULL ms.maps.

add_callchain_ip()
  thread__find_symbol(.., &al)
    thread__find_map(.., &al)   // al->maps becomes NULL
  ms.maps = maps__get(al.maps)
  callchain_cursor_append(..., &ms, ...)
    node->ms.maps = maps__get(ms->maps)

Then the path below would dereference NULL maps and get segfault.

fill_callchain_info()
  maps__machine(node->ms.maps);

Fix it by checking if maps is NULL in fill_callchain_info().

Fixes: 0dd5041c9a ("perf addr_location: Add init/exit/copy functions")
Signed-off-by: Casey Chen <cachen@purestorage.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Reviewed-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: yzhong@purestorage.com
Link: https://lore.kernel.org/r/20240722211548.61455-1-cachen@purestorage.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
2024-07-26 11:12:16 -07:00
..
2022-01-12 17:01:38 -08:00
2023-10-25 13:38:33 -07:00
2022-06-28 12:05:25 -03:00
2024-06-26 11:07:42 -07:00
2024-05-10 10:52:46 -03:00
2023-03-14 08:29:46 -03:00
2024-07-03 14:59:15 -07:00
2022-10-04 08:55:21 -03:00
2024-07-12 09:38:41 -07:00
2021-04-29 10:30:58 -03:00
2024-03-21 10:41:28 -03:00
2024-03-21 10:41:28 -03:00
2024-07-12 09:38:41 -07:00
2021-08-11 09:35:44 -03:00
2024-06-10 16:45:10 -07:00
2023-01-23 10:00:47 -03:00
2024-06-15 21:04:04 -07:00
2024-06-15 21:04:04 -07:00
2021-02-03 13:10:44 -03:00
2023-10-12 10:01:56 -07:00
2024-03-21 10:41:28 -03:00
2024-02-12 12:35:41 -08:00
2024-06-28 12:55:29 -07:00
2023-04-06 21:40:28 -03:00
2023-09-12 17:47:00 -03:00
2023-11-09 13:47:50 -03:00
2020-10-14 13:34:26 -03:00
2024-07-12 09:38:41 -07:00
2022-06-23 11:54:22 -03:00
2023-04-10 19:20:53 -03:00