aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Brauner <[email protected]>2024-08-06 18:02:31 +0200
committerChristian Brauner <[email protected]>2024-08-30 08:22:13 +0200
commit74ce208089f468db26eddcc5ea58e50f5bbbc291 (patch)
tree19f40cdf73b8899bff2257bae2698304cc90460e
parent3836b31c3e717fcaa2b63c69e4bcf8ff7b82e6e4 (diff)
proc: block mounting on top of /proc/<pid>/fd/*
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/[email protected] Reviewed-by: Josef Bacik <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
-rw-r--r--fs/proc/fd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index 105d6ce5b268..671a45884304 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -220,8 +220,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,