From: Christian Brauner <brauner@kernel.org>
To: linux-fsdevel@vger.kernel.org
Cc: linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
Jan Kara <jack@suse.cz>, Aleksa Sarai <cyphar@cyphar.com>,
Chris Mason <mason@kernel.org>,
"Christian Brauner (Amutable)" <brauner@kernel.org>
Subject: [PATCH 6/7] proc: explain which entries can't be mountpoints
Date: Sat, 24 Oct 2026 12:38:32 +0200 [thread overview]
Message-ID: <20261024-work-procfs-fixes-v1-6-46b03c3a8fac@kernel.org> (raw)
In-Reply-To: <20261024-work-procfs-fixes-v1-0-46b03c3a8fac@kernel.org>
Document how a failing ->d_revalidate() takes the mounts off a procfs
entry, which entries can't be mountpoints because of that and why the
other entries of a process are fine.
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
---
fs/proc/internal.h | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index b9aaac41c283..296ea13bbd49 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -425,9 +425,21 @@ static inline void pde_force_lookup(struct proc_dir_entry *pde)
}
/*
- * Add a new procfs dentry that can't serve as a mountpoint. That should
- * encompass anything that is ephemeral and can just disappear while the
- * process is still around.
+ * Add a new procfs dentry that can't serve as a mountpoint.
+ *
+ * If ->d_revalidate() fails the VFS calls d_invalidate() on the dentry. That
+ * detaches every mount on it and below it, in every mount namespace, locked
+ * mounts included, and the next lookup creates a new dentry without them. So
+ * nothing whose ->d_revalidate() can fail while the process is still around
+ * may be a mountpoint: the entries below fd/ and fdinfo/ once the fd is
+ * closed, the entries below map_files/ once the mapping is gone and
+ * everything below net/ where proc_net_d_revalidate() fails on every lookup.
+ * The links into /proc/self can't be mountpoints either. A mount on one of
+ * them would redirect every process that walks through it.
+ *
+ * The other entries of a process fail pid_revalidate() only once the task
+ * is gone and proc_flush_pid() invalidates them when it is reaped. Mounts
+ * on them go away together with the task.
*/
static inline struct dentry *proc_splice_unmountable(struct inode *inode,
struct dentry *dentry, const struct dentry_operations *d_ops)
--
2.53.0
next prev parent reply other threads:[~2026-10-24 10:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-24 10:38 [PATCH 0/7] proc: block mounts below /proc/<pid>/net and on the links into /proc/self Christian Brauner
2026-10-24 10:38 ` [PATCH 1/7] proc: don't let an entry below /proc/<pid>/net be a mountpoint Christian Brauner
2026-10-24 10:38 ` [PATCH 2/7] proc: don't let /proc/self and /proc/thread-self be mountpoints Christian Brauner
2026-10-24 10:38 ` [PATCH 3/7] proc: don't let /proc/mounts and /proc/net " Christian Brauner
2026-10-24 10:38 ` [PATCH 4/7] afs: create /proc/fs/afs with proc_self_symlink() Christian Brauner
2026-10-24 10:38 ` [PATCH 5/7] nfs: create the /proc/fs/nfsfs links " Christian Brauner
2026-10-24 10:38 ` Christian Brauner [this message]
2026-10-24 10:38 ` [PATCH 7/7] selftests/proc: test which entries can't be mountpoints Christian Brauner
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=20261024-work-procfs-fixes-v1-6-46b03c3a8fac@kernel.org \
--to=brauner@kernel.org \
--cc=cyphar@cyphar.com \
--cc=jack@suse.cz \
--cc=linux-afs@lists.infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=mason@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox