From 843ff37bb59edbe51d64e77ba1b3245a15a4dd9f Mon Sep 17 00:00:00 2001 From: Krister Johansen Date: Wed, 5 Jul 2017 18:48:08 -0700 Subject: perf symbols: Find symbols in different mount namespace Teach perf how to resolve symbols from binaries that are in a different mount namespace from the tool. This allows perf to generate meaningful stack traces even if the binary resides in a different mount namespace from the tool. Signed-off-by: Krister Johansen Tested-by: Brendan Gregg Cc: Alexander Shishkin Cc: Peter Zijlstra Cc: Thomas-Mich Richter Link: http://lkml.kernel.org/r/1499305693-1599-2-git-send-email-kjlx@templeofstupid.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/symbol.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tools/perf/util/symbol.c') diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index e7a98dbd2aed..60a9eaa372ef 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -18,6 +18,8 @@ #include "symbol.h" #include "strlist.h" #include "intlist.h" +#include "namespaces.h" +#include "vdso.h" #include "header.h" #include "path.h" #include "sane_ctype.h" @@ -1436,9 +1438,17 @@ int dso__load(struct dso *dso, struct map *map) struct symsrc *syms_ss = NULL, *runtime_ss = NULL; bool kmod; unsigned char build_id[BUILD_ID_SIZE]; + struct nscookie nsc; + nsinfo__mountns_enter(dso->nsinfo, &nsc); pthread_mutex_lock(&dso->lock); + /* The vdso files always live in the host container, so don't go looking + * for them in the container's mount namespace. + */ + if (dso__is_vdso(dso)) + nsinfo__mountns_exit(&nsc); + /* check again under the dso->lock */ if (dso__loaded(dso, map->type)) { ret = 1; @@ -1584,6 +1594,7 @@ out_free: out: dso__set_loaded(dso, map->type); pthread_mutex_unlock(&dso->lock); + nsinfo__mountns_exit(&nsc); return ret; } -- cgit v1.2.3