Skip to content

Commit

Permalink
proc: block mounting on top of /proc/<pid>/fdinfo/*
Browse files Browse the repository at this point in the history
Entries under /proc/<pid>/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 <josef@toxicpanda.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
  • Loading branch information
Christian Brauner committed Aug 30, 2024
1 parent 74ce208 commit cf71eaa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/proc/fd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down

0 comments on commit cf71eaa

Please sign in to comment.