Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf inject: Try chroot directory when reading build-id

When reading build-id from a DSO, it should consider if it's from a
chroot task. In that case, the path is different so it needs to prepend
the root directory to access the file correctly.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20220202070828.143303-4-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
75d48c56 67fd1892

+10
+10
tools/perf/builtin-inject.c
··· 25 25 #include "util/synthetic-events.h" 26 26 #include "util/thread.h" 27 27 #include "util/namespaces.h" 28 + #include "util/util.h" 28 29 29 30 #include <linux/err.h> 30 31 #include <subcmd/parse-options.h> ··· 551 550 nsinfo__mountns_enter(dso->nsinfo, &nsc); 552 551 if (filename__read_build_id(dso->long_name, &dso->bid) > 0) 553 552 dso->has_build_id = true; 553 + else if (dso->nsinfo) { 554 + char *new_name; 555 + 556 + new_name = filename_with_chroot(dso->nsinfo->pid, 557 + dso->long_name); 558 + if (new_name && filename__read_build_id(new_name, &dso->bid) > 0) 559 + dso->has_build_id = true; 560 + free(new_name); 561 + } 554 562 nsinfo__mountns_exit(&nsc); 555 563 556 564 return dso->has_build_id ? 0 : -1;