From: Christian Brauner Date: Tue, 6 Aug 2024 16:02:32 +0000 (+0200) Subject: proc: block mounting on top of /proc//fdinfo/* X-Git-Tag: microblaze-v6.13~214^2~1^2 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=cf71eaa1ad18d6f6e130cda708300b587176f16f;p=linux-2.6-microblaze.git proc: block mounting on top of /proc//fdinfo/* Entries under /proc//fdinfo/* 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-6-fb04e1d09f0c@kernel.org Reviewed-by: Josef Bacik Signed-off-by: Christian Brauner --- diff --git a/fs/proc/fd.c b/fs/proc/fd.c index 671a45884304..623780449c48 100644 --- a/fs/proc/fd.c +++ b/fs/proc/fd.c @@ -397,8 +397,8 @@ static struct dentry *proc_fdinfo_instantiate(struct dentry *dentry, inode->i_fop = &proc_fdinfo_file_operations; tid_fd_update_inode(task, inode, 0); - 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 *