[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220916175902.1155177-5-namhyung@kernel.org>
Date: Fri, 16 Sep 2022 10:59:02 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>,
Jiri Olsa <jolsa@...nel.org>
Cc: Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
LKML <linux-kernel@...r.kernel.org>,
Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
linux-perf-users@...r.kernel.org
Subject: [PATCH 4/4] perf tools: Honor namespace when synthesizing build-id
It needs to go into a namespace before reading a file.
Signed-off-by: Namhyung Kim <namhyung@...nel.org>
---
tools/perf/util/synthetic-events.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic-events.c
index e6978b2dee8f..d0d540d09196 100644
--- a/tools/perf/util/synthetic-events.c
+++ b/tools/perf/util/synthetic-events.c
@@ -391,6 +391,8 @@ static void perf_record_mmap2__read_build_id(struct perf_record_mmap2 *event,
struct build_id _bid, *bid = &_bid;
struct dso *dso = NULL;
struct dso_id id;
+ struct nsinfo *nsi;
+ struct nscookie nc;
int rc;
if (is_kernel) {
@@ -410,8 +412,14 @@ static void perf_record_mmap2__read_build_id(struct perf_record_mmap2 *event,
goto out;
}
+ nsi = nsinfo__new(event->pid);
+ nsinfo__mountns_enter(nsi, &nc);
+
rc = filename__read_build_id(event->filename, bid) > 0 ? 0 : -1;
+ nsinfo__mountns_exit(&nc);
+ nsinfo__put(nsi);
+
out:
if (rc == 0) {
memcpy(event->build_id, bid->data, sizeof(bid->data));
--
2.37.3.968.ga6b4b080e4-goog
Powered by blists - more mailing lists