[SRU][N][PATCH 5/6] proc: block mounting on top of /proc/<pid>/fd/*
Yufeng Gao
yufeng.gao at canonical.com
Wed May 27 00:40:56 UTC 2026
From: Christian Brauner <brauner at kernel.org>
BugLink: https://bugs.launchpad.net/bugs/2137199
Entries under /proc/<pid>/fd/* are ephemeral and may go away before the
process dies. As such allowing them to be used as mount points creates
the ability to leak mounts that linger until the process dies with no
ability to unmount them until then. Don't allow using them as
mountpoints.
Link: https://lore.kernel.org/r/20240806-work-procfs-v1-5-fb04e1d09f0c@kernel.org
Reviewed-by: Josef Bacik <josef at toxicpanda.com>
Signed-off-by: Christian Brauner <brauner at kernel.org>
(cherry picked from commit 74ce208089f468db26eddcc5ea58e50f5bbbc291)
Signed-off-by: Yufeng Gao <yufeng.gao at canonical.com>
---
fs/proc/fd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index e29d2d6e7ddb..e1734092f3bd 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -222,8 +222,8 @@ static struct dentry *proc_fd_instantiate(struct dentry *dentry,
ei->op.proc_get_link = proc_fd_link;
tid_fd_update_inode(task, inode, data->mode);
- d_set_d_op(dentry, &tid_fd_dentry_operations);
- return d_splice_alias(inode, dentry);
+ return proc_splice_unmountable(inode, dentry,
+ &tid_fd_dentry_operations);
}
static struct dentry *proc_lookupfd_common(struct inode *dir,
--
2.43.0
More information about the kernel-team
mailing list