diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 5ad92fa72e78..253dd8dd0e12 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -21,6 +21,7 @@ #include "bpf-event.h" #include #include +#include #include "parse-events.h" #include @@ -1824,6 +1825,14 @@ static void *perf_evlist__poll_thread(void *arg) struct evlist *evlist = arg; bool draining = false; int i, done = 0; + /* + * In order to read symbols from other namespaces perf to needs to call + * setns(2). This isn't permitted if the struct_fs has multiple users. + * unshare(2) the fs so that we may continue to setns into namespaces + * that we're observing when, for instance, reading the build-ids at + * the end of a 'perf record' session. + */ + unshare(CLONE_FS); while (!done) { bool got_data = false;