All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ian Rogers <irogers@google.com>, Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	James Clark <james.clark@linaro.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org,
	Athira Rajeev <atrajeev@linux.ibm.com>
Subject: [PATCH v5 06/11] perf tools: Verify thread status and mount namespace inode
Date: Sun, 29 Nov 2026 16:20:40 -0800	[thread overview]
Message-ID: <20261130002045.1964237-7-namhyung@kernel.org> (raw)
In-Reply-To: <20261130002045.1964237-1-namhyung@kernel.org>

Verify /proc/<pid>/task/<tid>/status exists and has Tgid == pid before
reading or entering a thread's namespaces (using strstarts() so Name:
lines cannot spoof Tgid:/NStgid:) to guard against PID/TID recycling.
Pin a reference-counted host /proc file descriptor across
nsinfo__mountns_enter()/exit() (bailing out if /proc cannot be opened),
and access relative /proc paths through nsinfo__proc_open(),
nsinfo__proc_stat(), and nsinfo__proc_readlink() using stack buffers
instead of heap-allocating mntns_path or keeping a permanent /proc
descriptor open.

Also record the mount namespace inode (mntns_ino) during initialization,
mark nsinfo exited if stating ns/mnt fails with ENOENT or ESRCH, and
verify via fstat() that the opened namespace file descriptor still
refers to the same mount namespace before calling setns().

Tested-by: Athira Rajeev <atrajeev@linux.ibm.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/namespaces.c | 348 +++++++++++++++++++++++++++--------
 tools/perf/util/namespaces.h |   9 +-
 2 files changed, 283 insertions(+), 74 deletions(-)

diff --git a/tools/perf/util/namespaces.c b/tools/perf/util/namespaces.c
index 940132d3458be4c7..c8a7436fb5d0bdc9 100644
--- a/tools/perf/util/namespaces.c
+++ b/tools/perf/util/namespaces.c
@@ -6,6 +6,7 @@
 
 #include "namespaces.h"
 #include "event.h"
+#include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -17,6 +18,7 @@
 #include <unistd.h>
 #include <asm/bug.h>
 #include <linux/kernel.h>
+#include <linux/string.h>
 #include <linux/zalloc.h>
 
 static const char *perf_ns__names[] = {
@@ -59,25 +61,115 @@ void namespaces__free(struct namespaces *namespaces)
 	free(namespaces);
 }
 
-static int nsinfo__get_nspid(pid_t *tgid, pid_t *nstgid, bool *in_pidns, const char *path)
+static DEFINE_MUTEX(host_proc_lock);
+static int host_proc_fd __guarded_by(&host_proc_lock) = -1;
+static unsigned int host_proc_refcnt __guarded_by(&host_proc_lock);
+
+static int nsinfo__host_proc_get(void)
+{
+	int ret = 0;
+
+	mutex_lock(&host_proc_lock);
+	if (host_proc_refcnt == 0) {
+		host_proc_fd = open("/proc", O_RDONLY | O_DIRECTORY | O_CLOEXEC);
+		if (host_proc_fd < 0)
+			ret = -1;
+		else
+			host_proc_refcnt = 1;
+	} else {
+		host_proc_refcnt++;
+	}
+	mutex_unlock(&host_proc_lock);
+	return ret;
+}
+
+static void nsinfo__host_proc_put(void)
+{
+	mutex_lock(&host_proc_lock);
+	if (host_proc_refcnt > 0 && --host_proc_refcnt == 0 &&
+	    host_proc_fd >= 0) {
+		close(host_proc_fd);
+		host_proc_fd = -1;
+	}
+	mutex_unlock(&host_proc_lock);
+}
+
+static int nsinfo__proc_open(const char *rel_path, int flags)
+{
+	char path[64];
+	int ret;
+
+	mutex_lock(&host_proc_lock);
+	if (host_proc_fd >= 0) {
+		ret = openat(host_proc_fd, rel_path, flags);
+	} else {
+		scnprintf(path, sizeof(path), "/proc/%s", rel_path);
+		ret = open(path, flags);
+	}
+	mutex_unlock(&host_proc_lock);
+	return ret;
+}
+
+static int nsinfo__proc_stat(const char *rel_path, struct stat *st)
+{
+	char path[64];
+	int ret;
+
+	mutex_lock(&host_proc_lock);
+	if (host_proc_fd >= 0) {
+		ret = fstatat(host_proc_fd, rel_path, st, 0);
+	} else {
+		scnprintf(path, sizeof(path), "/proc/%s", rel_path);
+		ret = stat(path, st);
+	}
+	mutex_unlock(&host_proc_lock);
+	return ret;
+}
+
+ssize_t nsinfo__proc_readlink(const char *rel_path, char *buf, size_t size)
+{
+	char path[64];
+	ssize_t ret;
+
+	mutex_lock(&host_proc_lock);
+	if (host_proc_fd >= 0) {
+		ret = readlinkat(host_proc_fd, rel_path, buf, size);
+	} else {
+		scnprintf(path, sizeof(path), "/proc/%s", rel_path);
+		ret = readlink(path, buf, size);
+	}
+	mutex_unlock(&host_proc_lock);
+	return ret;
+}
+
+static int nsinfo__get_nspid(pid_t *tgid, pid_t *nstgid, bool *in_pidns,
+			     const char *rel_path)
 {
 	FILE *f = NULL;
 	char *statln = NULL;
 	size_t linesz = 0;
 	char *nspid;
+	int fd;
+	bool got_tgid = false;
 
-	f = fopen(path, "r");
-	if (f == NULL)
+	fd = nsinfo__proc_open(rel_path, O_RDONLY | O_CLOEXEC);
+	if (fd < 0)
+		return -1;
+	f = fdopen(fd, "r");
+	if (f == NULL) {
+		close(fd);
 		return -1;
+	}
 
 	while (getline(&statln, &linesz, f) != -1) {
 		/* Use tgid if CONFIG_PID_NS is not defined. */
-		if (strstr(statln, "Tgid:") != NULL) {
+		if (strstarts(statln, "Tgid:\t")) {
 			*tgid = (pid_t)strtol(strrchr(statln, '\t'), NULL, 10);
 			*nstgid = *tgid;
+			got_tgid = true;
 		}
 
-		if (strstr(statln, "NStgid:") != NULL) {
+		if (strstarts(statln, "NStgid:\t")) {
 			nspid = strrchr(statln, '\t');
 			*nstgid = (pid_t)strtol(nspid, NULL, 10);
 			/*
@@ -91,7 +183,17 @@ static int nsinfo__get_nspid(pid_t *tgid, pid_t *nstgid, bool *in_pidns, const c
 
 	fclose(f);
 	free(statln);
-	return 0;
+	return got_tgid ? 0 : -1;
+}
+
+static int nsinfo__get_task_nspid(const struct nsinfo *nsi,
+				  pid_t *tgid, pid_t *nstgid, bool *in_pidns)
+{
+	char spath[64];
+
+	scnprintf(spath, sizeof(spath), "%d/task/%d/status",
+		  nsinfo__pid(nsi), nsinfo__tid(nsi));
+	return nsinfo__get_nspid(tgid, nstgid, in_pidns, spath);
 }
 
 static struct mutex *nsinfo__lock(const struct nsinfo *nsi)
@@ -100,53 +202,69 @@ static struct mutex *nsinfo__lock(const struct nsinfo *nsi)
 	return (struct mutex *)&RC_CHK_ACCESS(nsi)->lock;
 }
 
+static void nsinfo__clear_need_setns_locked(struct nsinfo *nsi)
+	__must_hold(nsinfo__lock(nsi))
+{
+	RC_CHK_ACCESS(nsi)->inited = true;
+	RC_CHK_ACCESS(nsi)->need_setns = false;
+}
+
+static void nsinfo__set_exited_locked(struct nsinfo *nsi)
+	__must_hold(nsinfo__lock(nsi))
+{
+	RC_CHK_ACCESS(nsi)->exited = true;
+	nsinfo__clear_need_setns_locked(nsi);
+}
+
 static int nsinfo__init_locked(struct nsinfo *nsi)
 	__must_hold(nsinfo__lock(nsi))
 {
-	char oldns[PATH_MAX];
-	char spath[PATH_MAX];
-	char *newns = NULL;
+	char newns[64];
 	struct stat old_stat;
 	struct stat new_stat;
-	int rv = -1;
+	pid_t tgid = 0, nstgid = 0;
+	bool in_pidns = false;
+
+	if (RC_CHK_ACCESS(nsi)->exited)
+		return -1;
 
 	RC_CHK_ACCESS(nsi)->inited = true;
 
-	if (snprintf(oldns, PATH_MAX, "/proc/self/ns/mnt") >= PATH_MAX)
-		return rv;
+	/*
+	 * Verify that the thread (pid, tid) still exists in /proc and its Tgid
+	 * matches pid (guarding against PID/TID recycling), while resolving the
+	 * innermost tgid if the process is in a different PID namespace.
+	 */
+	if (nsinfo__get_task_nspid(nsi, &tgid, &nstgid, &in_pidns) < 0 ||
+	    tgid != nsinfo__pid(nsi)) {
+		nsinfo__set_exited_locked(nsi);
+		return -1;
+	}
 
-	if (asprintf(&newns, "/proc/%d/task/%d/ns/mnt",
-		     nsinfo__pid(nsi), nsinfo__tid(nsi)) == -1)
-		return rv;
+	RC_CHK_ACCESS(nsi)->tgid = tgid;
+	RC_CHK_ACCESS(nsi)->nstgid = nstgid;
+	RC_CHK_ACCESS(nsi)->in_pidns = in_pidns;
 
-	if (stat(oldns, &old_stat) < 0)
-		goto out;
+	if (nsinfo__proc_stat("self/ns/mnt", &old_stat) < 0)
+		return -1;
 
-	if (stat(newns, &new_stat) < 0)
-		goto out;
+	scnprintf(newns, sizeof(newns), "%d/task/%d/ns/mnt",
+		  nsinfo__pid(nsi), nsinfo__tid(nsi));
+	if (nsinfo__proc_stat(newns, &new_stat) < 0) {
+		if (errno == ENOENT || errno == ESRCH)
+			nsinfo__set_exited_locked(nsi);
+		return -1;
+	}
 
 	/* Check if the mount namespaces differ, if so then indicate that we
 	 * want to switch as part of looking up dso/map data.
 	 */
 	if (old_stat.st_ino != new_stat.st_ino) {
 		RC_CHK_ACCESS(nsi)->need_setns = true;
-		RC_CHK_ACCESS(nsi)->mntns_path = newns;
-		newns = NULL;
+		RC_CHK_ACCESS(nsi)->mntns_ino = new_stat.st_ino;
 	}
 
-	/* If we're dealing with a process that is in a different PID namespace,
-	 * attempt to work out the innermost tgid for the process.
-	 */
-	if (snprintf(spath, PATH_MAX, "/proc/%d/task/%d/status",
-		     nsinfo__pid(nsi), nsinfo__tid(nsi)) >= PATH_MAX)
-		goto out;
-
-	rv = nsinfo__get_nspid(&RC_CHK_ACCESS(nsi)->tgid, &RC_CHK_ACCESS(nsi)->nstgid,
-			       &RC_CHK_ACCESS(nsi)->in_pidns, spath);
-
-out:
-	free(newns);
-	return rv;
+	return 0;
 }
 
 int nsinfo__init(struct nsinfo *nsi)
@@ -165,7 +283,7 @@ int nsinfo__init(struct nsinfo *nsi)
 static void nsinfo__ensure_init_locked(struct nsinfo *nsi)
 	__must_hold(nsinfo__lock(nsi))
 {
-	if (!RC_CHK_ACCESS(nsi)->inited)
+	if (!RC_CHK_ACCESS(nsi)->inited && !RC_CHK_ACCESS(nsi)->exited)
 		nsinfo__init_locked(nsi);
 }
 
@@ -212,8 +330,8 @@ struct nsinfo *nsinfo__copy(const struct nsinfo *nsi)
 {
 	struct nsinfo *nnsi;
 	pid_t pid, tid, tgid, nstgid;
-	bool inited, need_setns, in_pidns;
-	char *mntns_path = NULL;
+	ino_t mntns_ino;
+	bool inited, exited, need_setns, in_pidns;
 
 	if (nsi == NULL)
 		return NULL;
@@ -227,17 +345,11 @@ struct nsinfo *nsinfo__copy(const struct nsinfo *nsi)
 	tid = RC_CHK_ACCESS(nsi)->tid;
 	tgid = RC_CHK_ACCESS(nsi)->tgid;
 	nstgid = RC_CHK_ACCESS(nsi)->nstgid;
+	mntns_ino = RC_CHK_ACCESS(nsi)->mntns_ino;
 	inited = RC_CHK_ACCESS(nsi)->inited;
+	exited = RC_CHK_ACCESS(nsi)->exited;
 	need_setns = RC_CHK_ACCESS(nsi)->need_setns;
 	in_pidns = RC_CHK_ACCESS(nsi)->in_pidns;
-	if (RC_CHK_ACCESS(nsi)->mntns_path) {
-		mntns_path = strdup(RC_CHK_ACCESS(nsi)->mntns_path);
-		if (!mntns_path) {
-			mutex_unlock(nsinfo__lock(nsi));
-			nsinfo__put(nnsi);
-			return NULL;
-		}
-	}
 	mutex_unlock(nsinfo__lock(nsi));
 
 	RC_CHK_ACCESS(nnsi)->pid = pid;
@@ -245,10 +357,11 @@ struct nsinfo *nsinfo__copy(const struct nsinfo *nsi)
 	mutex_lock(nsinfo__lock(nnsi));
 	RC_CHK_ACCESS(nnsi)->tgid = tgid;
 	RC_CHK_ACCESS(nnsi)->nstgid = nstgid;
+	RC_CHK_ACCESS(nnsi)->mntns_ino = mntns_ino;
 	RC_CHK_ACCESS(nnsi)->inited = inited;
+	RC_CHK_ACCESS(nnsi)->exited = exited;
 	RC_CHK_ACCESS(nnsi)->need_setns = need_setns;
 	RC_CHK_ACCESS(nnsi)->in_pidns = in_pidns;
-	RC_CHK_ACCESS(nnsi)->mntns_path = mntns_path;
 	mutex_unlock(nsinfo__lock(nnsi));
 
 	return nnsi;
@@ -263,9 +376,6 @@ static void nsinfo__delete(struct nsinfo *nsi)
 {
 	if (nsi) {
 		WARN_ONCE(refcount_read(nsinfo__refcnt(nsi)) != 0, "nsinfo refcnt unbalanced\n");
-		mutex_lock(nsinfo__lock(nsi));
-		zfree(&RC_CHK_ACCESS(nsi)->mntns_path);
-		mutex_unlock(nsinfo__lock(nsi));
 		mutex_destroy(&RC_CHK_ACCESS(nsi)->lock);
 		RC_CHK_FREE(nsi);
 	}
@@ -289,6 +399,46 @@ void nsinfo__put(struct nsinfo *nsi)
 		RC_CHK_PUT(nsi);
 }
 
+bool nsinfo__inited(const struct nsinfo *nsi)
+{
+	bool ret;
+
+	if (!nsi)
+		return false;
+
+	mutex_lock(nsinfo__lock(nsi));
+	ret = RC_CHK_ACCESS(nsi)->inited;
+	mutex_unlock(nsinfo__lock(nsi));
+	return ret;
+}
+
+bool nsinfo__exited(const struct nsinfo *nsi)
+{
+	bool ret;
+
+	if (!nsi)
+		return false;
+
+	mutex_lock(nsinfo__lock(nsi));
+	ret = RC_CHK_ACCESS(nsi)->exited;
+	mutex_unlock(nsinfo__lock(nsi));
+	return ret;
+}
+
+ino_t nsinfo__mntns_ino(const struct nsinfo *nsi)
+{
+	ino_t ret;
+
+	if (!nsi)
+		return 0;
+
+	mutex_lock(nsinfo__lock(nsi));
+	nsinfo__ensure_init_locked((struct nsinfo *)nsi);
+	ret = RC_CHK_ACCESS(nsi)->mntns_ino;
+	mutex_unlock(nsinfo__lock(nsi));
+	return ret;
+}
+
 bool nsinfo__need_setns(const struct nsinfo *nsi)
 {
 	bool ret;
@@ -298,7 +448,7 @@ bool nsinfo__need_setns(const struct nsinfo *nsi)
 
 	mutex_lock(nsinfo__lock(nsi));
 	nsinfo__ensure_init_locked((struct nsinfo *)nsi);
-	ret = RC_CHK_ACCESS(nsi)->need_setns;
+	ret = !RC_CHK_ACCESS(nsi)->exited && RC_CHK_ACCESS(nsi)->need_setns;
 	mutex_unlock(nsinfo__lock(nsi));
 	return ret;
 }
@@ -309,12 +459,44 @@ void nsinfo__clear_need_setns(struct nsinfo *nsi)
 		return;
 
 	mutex_lock(nsinfo__lock(nsi));
-	RC_CHK_ACCESS(nsi)->inited = true;
-	RC_CHK_ACCESS(nsi)->need_setns = false;
-	zfree(&RC_CHK_ACCESS(nsi)->mntns_path);
+	nsinfo__clear_need_setns_locked(nsi);
+	mutex_unlock(nsinfo__lock(nsi));
+}
+
+void nsinfo__set_exited(struct nsinfo *nsi)
+{
+	if (!nsi)
+		return;
+
+	mutex_lock(nsinfo__lock(nsi));
+	nsinfo__set_exited_locked(nsi);
 	mutex_unlock(nsinfo__lock(nsi));
 }
 
+bool nsinfo__check_proc(struct nsinfo *nsi)
+{
+	pid_t tgid = 0, nstgid = 0;
+	bool in_pidns = false;
+	bool exited;
+
+	if (!nsi)
+		return false;
+
+	mutex_lock(nsinfo__lock(nsi));
+	exited = RC_CHK_ACCESS(nsi)->exited;
+	mutex_unlock(nsinfo__lock(nsi));
+	if (exited)
+		return false;
+
+	if (nsinfo__get_task_nspid(nsi, &tgid, &nstgid, &in_pidns) < 0 ||
+	    tgid != nsinfo__pid(nsi)) {
+		nsinfo__set_exited(nsi);
+		return false;
+	}
+
+	return true;
+}
+
 pid_t nsinfo__tgid(const struct nsinfo *nsi)
 {
 	pid_t ret;
@@ -369,7 +551,10 @@ void nsinfo__mountns_enter(struct nsinfo *nsi,
 				  struct nscookie *nc)
 {
 	char curpath[PATH_MAX];
-	char *mntns_path = NULL;
+	char mntns_path[64];
+	ino_t mntns_ino = 0;
+	bool need_setns = false;
+	struct stat st;
 	int oldns = -1;
 	int newns = -1;
 	char *oldcwd = NULL;
@@ -379,66 +564,77 @@ void nsinfo__mountns_enter(struct nsinfo *nsi,
 
 	nc->oldns = -1;
 	nc->newns = -1;
+	nc->oldcwd = NULL;
 
 	if (!nsi)
 		return;
 
 	mutex_lock(nsinfo__lock(nsi));
 	nsinfo__ensure_init_locked(nsi);
-	if (RC_CHK_ACCESS(nsi)->need_setns && RC_CHK_ACCESS(nsi)->mntns_path)
-		mntns_path = strdup(RC_CHK_ACCESS(nsi)->mntns_path);
+	if (!RC_CHK_ACCESS(nsi)->exited && RC_CHK_ACCESS(nsi)->need_setns) {
+		need_setns = true;
+		mntns_ino = RC_CHK_ACCESS(nsi)->mntns_ino;
+	}
 	mutex_unlock(nsinfo__lock(nsi));
 
-	if (!mntns_path)
+	if (!need_setns)
+		return;
+
+	if (!nsinfo__check_proc(nsi))
 		return;
 
 	if (!getcwd(curpath, sizeof(curpath)))
-		goto out;
+		return;
 
 	oldcwd = strdup(curpath);
 	if (!oldcwd)
-		goto out;
+		return;
 
-	oldns = open("/proc/self/ns/mnt", O_RDONLY);
+	/* Pin host /proc before entering any target mount namespace. */
+	if (nsinfo__host_proc_get() < 0) {
+		free(oldcwd);
+		return;
+	}
+
+	oldns = nsinfo__proc_open("self/ns/mnt", O_RDONLY | O_CLOEXEC);
 	if (oldns < 0)
 		goto errout;
 
-	newns = open(mntns_path, O_RDONLY);
+	scnprintf(mntns_path, sizeof(mntns_path), "%d/task/%d/ns/mnt",
+		  nsinfo__pid(nsi), nsinfo__tid(nsi));
+	newns = nsinfo__proc_open(mntns_path, O_RDONLY | O_CLOEXEC);
 	if (newns < 0)
 		goto errout;
 
+	if (fstat(newns, &st) < 0 || st.st_ino != mntns_ino) {
+		nsinfo__clear_need_setns(nsi);
+		goto errout;
+	}
+
 	if (setns(newns, CLONE_NEWNS) < 0)
 		goto errout;
 
-	free(mntns_path);
 	nc->oldcwd = oldcwd;
 	nc->oldns = oldns;
 	nc->newns = newns;
 	return;
 
 errout:
+	nsinfo__host_proc_put();
 	free(oldcwd);
 	if (oldns > -1)
 		close(oldns);
 	if (newns > -1)
 		close(newns);
-out:
-	free(mntns_path);
 }
 
 void nsinfo__mountns_exit(struct nscookie *nc)
 {
-	if (nc == NULL || nc->oldns == -1 || nc->newns == -1 || !nc->oldcwd)
+	if (nc == NULL || !nc->oldcwd)
 		return;
 
-	setns(nc->oldns, CLONE_NEWNS);
-
-	if (nc->oldcwd) {
-		WARN_ON_ONCE(chdir(nc->oldcwd));
-		zfree(&nc->oldcwd);
-	}
-
 	if (nc->oldns > -1) {
+		setns(nc->oldns, CLONE_NEWNS);
 		close(nc->oldns);
 		nc->oldns = -1;
 	}
@@ -447,6 +643,12 @@ void nsinfo__mountns_exit(struct nscookie *nc)
 		close(nc->newns);
 		nc->newns = -1;
 	}
+
+	if (nc->oldcwd) {
+		WARN_ON_ONCE(chdir(nc->oldcwd));
+		zfree(&nc->oldcwd);
+	}
+	nsinfo__host_proc_put();
 }
 
 char *nsinfo__realpath(const char *path, struct nsinfo *nsi)
@@ -478,6 +680,6 @@ bool nsinfo__is_in_root_namespace(void)
 	pid_t tgid = 0, nstgid = 0;
 	bool in_pidns = false;
 
-	nsinfo__get_nspid(&tgid, &nstgid, &in_pidns, "/proc/self/status");
+	nsinfo__get_nspid(&tgid, &nstgid, &in_pidns, "self/status");
 	return !in_pidns;
 }
diff --git a/tools/perf/util/namespaces.h b/tools/perf/util/namespaces.h
index 4e30b015db40caf5..441cab597ae45e80 100644
--- a/tools/perf/util/namespaces.h
+++ b/tools/perf/util/namespaces.h
@@ -37,10 +37,11 @@ DECLARE_RC_STRUCT(nsinfo) {
 	pid_t			tid;
 	pid_t			tgid __guarded_by(&lock);
 	pid_t			nstgid __guarded_by(&lock);
+	ino_t			mntns_ino __guarded_by(&lock);
 	bool			inited __guarded_by(&lock);
+	bool			exited __guarded_by(&lock);
 	bool			need_setns __guarded_by(&lock);
 	bool			in_pidns __guarded_by(&lock);
-	char			*mntns_path __guarded_by(&lock);
 	refcount_t		refcnt;
 };
 
@@ -58,8 +59,14 @@ struct nsinfo *nsinfo__copy(const struct nsinfo *nsi);
 struct nsinfo *nsinfo__get(struct nsinfo *nsi);
 void nsinfo__put(struct nsinfo *nsi);
 
+bool nsinfo__inited(const struct nsinfo *nsi);
+bool nsinfo__exited(const struct nsinfo *nsi);
+ino_t nsinfo__mntns_ino(const struct nsinfo *nsi);
 bool nsinfo__need_setns(const struct nsinfo *nsi);
 void nsinfo__clear_need_setns(struct nsinfo *nsi);
+void nsinfo__set_exited(struct nsinfo *nsi);
+bool nsinfo__check_proc(struct nsinfo *nsi);
+ssize_t nsinfo__proc_readlink(const char *rel_path, char *buf, size_t size);
 pid_t nsinfo__tgid(const struct nsinfo  *nsi);
 pid_t nsinfo__nstgid(const struct nsinfo  *nsi);
 pid_t nsinfo__pid(const struct nsinfo  *nsi);
-- 
2.56.1.839.g22a8290db9-goog


  parent reply	other threads:[~2026-11-30  0:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  0:20 [PATCH v5 00/11] perf tools: Enhance namespace and chroot handling Namhyung Kim
2026-11-30  0:20 ` [PATCH v5 01/11] perf tools: Add HEADER_BOOT_ID feature Namhyung Kim
2026-11-30 14:14   ` Athira Rajeev
2026-11-30  0:20 ` [PATCH v5 02/11] perf tools: Add perf_env__is_same_boot() Namhyung Kim
2026-11-30  0:20 ` [PATCH v5 03/11] perf tools: Add nsinfo__new_thread() to track tid Namhyung Kim
2026-11-30  0:20 ` [PATCH v5 04/11] perf tools: Add lock to struct nsinfo Namhyung Kim
2026-11-30  0:20 ` [PATCH v5 05/11] perf tools: Defer /proc lookup until nsinfo is used Namhyung Kim
2026-11-30  0:20 ` Namhyung Kim [this message]
2026-11-30  0:20 ` [PATCH v5 07/11] perf tools: Check thread liveness when accessing /proc Namhyung Kim
2026-11-30  0:20 ` [PATCH v5 08/11] perf tools: Export filename__read_build_id_ns() Namhyung Kim
2026-11-30  0:20 ` [PATCH v5 09/11] perf tools: Only enter mount namespace if necessary Namhyung Kim
2026-11-30  0:20 ` [PATCH v5 10/11] perf tools: Scope mount namespace entry in dso__load() Namhyung Kim
2026-11-30  0:20 ` [PATCH v5 11/11] perf tests: Add namespace, nsinfo, and boot ID tests Namhyung Kim
2026-11-30  0:34 ` [PATCH v5 00/11] perf tools: Enhance namespace and chroot handling sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261130002045.1964237-7-namhyung@kernel.org \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=atrajeev@linux.ibm.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.