diff options
author | Krister Johansen <kjlx@templeofstupid.com> | 2017-07-05 18:48:08 -0700 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-07-18 23:14:09 -0300 |
commit | 843ff37bb59edbe51d64e77ba1b3245a15a4dd9f (patch) | |
tree | 7c1e50cb4b60af9776364ec65118c9a0db0cbcdf /tools/perf/util/symbol.c | |
parent | 86bcdb5a43997bb02ba25a76482c7bfc652ba45b (diff) |
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 <kjlx@templeofstupid.com>
Tested-by: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1499305693-1599-2-git-send-email-kjlx@templeofstupid.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r-- | tools/perf/util/symbol.c | 11 |
1 files changed, 11 insertions, 0 deletions
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; } |