]> git.itanic.dy.fi Git - linux-stable/commitdiff
perf unwind-libunwind: Fix base address for .eh_frame
authorNamhyung Kim <namhyung@kernel.org>
Tue, 12 Dec 2023 07:05:46 +0000 (23:05 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 14 Dec 2023 22:08:53 +0000 (19:08 -0300)
The base address of a DSO mapping should start at the start of the file.
Usually DSOs are mapped from the pgoff 0 so it doesn't matter when it
uses the start of the map address.

But generated DSOs for JIT codes doesn't start from the 0 so it should
subtract the offset to calculate the .eh_frame table offsets correctly.

Fixes: dc2cf4ca866f5715 ("perf unwind: Fix segbase for ld.lld linked objects")
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Fangrui Song <maskray@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Pablo Galindo <pablogsal@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20231212070547.612536-4-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/unwind-libunwind-local.c

index c0641882fd2fd7eef7991bc7b83fee0d3d03009b..5e5c3395a499899daec3452ea8a7fd15bd61901e 100644 (file)
@@ -327,7 +327,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct unwind_info *ui,
 
        maps__for_each_entry(thread__maps(ui->thread), map_node) {
                struct map *map = map_node->map;
-               u64 start = map__start(map);
+               u64 start = map__start(map) - map__pgoff(map);
 
                if (map__dso(map) == dso && start < base_addr)
                        base_addr = start;