From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Christian Brauner <brauner@kernel.org>,
Josef Bacik <josef@toxicpanda.com>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.10.y 2/6] proc: add proc_splice_unmountable()
Date: Wed, 11 Nov 2026 17:44:07 -0500 [thread overview]
Message-ID: <20261111224335.80100-2-sashal@kernel.org> (raw)
In-Reply-To: <20261111224335.80100-1-sashal@kernel.org>
From: Christian Brauner <brauner@kernel.org>
[ Upstream commit 32a0a965b8a5b7b505babae2ee10c513ede376d8 ]
Add a tiny procfs helper to splice a dentry that cannot be mounted upon.
Link: https://lore.kernel.org/r/20240806-work-procfs-v1-3-fb04e1d09f0c@kernel.org
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Stable-dep-of: eeecea75ece2 ("proc: don't let an entry below /proc/<pid>/net be a mountpoint")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/proc/internal.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index e601bf77a5f80..e35e28415dd8e 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -331,3 +331,16 @@ static inline void pde_force_lookup(struct proc_dir_entry *pde)
/* /proc/net/ entries can be changed under us by setns(CLONE_NEWNET) */
pde->proc_dops = &proc_net_dentry_ops;
}
+
+/*
+ * 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.
+ */
+static inline struct dentry *proc_splice_unmountable(struct inode *inode,
+ struct dentry *dentry, const struct dentry_operations *d_ops)
+{
+ d_set_d_op(dentry, d_ops);
+ dont_mount(dentry);
+ return d_splice_alias(inode, dentry);
+}
--
2.53.0
next prev parent reply other threads:[~2026-11-11 22:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 11:30 FAILED: patch "[PATCH] proc: don't let an entry below /proc/<pid>/net be a mountpoint" failed to apply to 5.10-stable tree Sasha Levin
2026-11-11 22:44 ` [PATCH 5.10.y 1/6] /proc/sys: use d_splice_alias() calling conventions to simplify failure exits Sasha Levin
2026-11-11 22:44 ` Sasha Levin [this message]
2026-11-11 22:44 ` [PATCH 5.10.y 3/6] procfs: kill ->proc_dops Sasha Levin
2026-11-11 22:44 ` [PATCH 5.10.y 4/6] new helper: d_splice_alias_ops() Sasha Levin
2026-11-11 22:44 ` [PATCH 5.10.y 5/6] switch procfs from d_set_d_op() to d_splice_alias_ops() Sasha Levin
2026-11-11 22:44 ` [PATCH 5.10.y 6/6] proc: don't let an entry below /proc/<pid>/net be a mountpoint Sasha Levin
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=20261111224335.80100-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=brauner@kernel.org \
--cc=josef@toxicpanda.com \
--cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox