Skip to content

Commit 3836b31

Browse files
committed
proc: block mounting on top of /proc/<pid>/map_files/*
Entries under /proc/<pid>/map_files/* 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-4-fb04e1d09f0c@kernel.org Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 32a0a96 commit 3836b31

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/proc/base.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2276,8 +2276,8 @@ proc_map_files_instantiate(struct dentry *dentry,
22762276
inode->i_op = &proc_map_files_link_inode_operations;
22772277
inode->i_size = 64;
22782278

2279-
d_set_d_op(dentry, &tid_map_files_dentry_operations);
2280-
return d_splice_alias(inode, dentry);
2279+
return proc_splice_unmountable(inode, dentry,
2280+
&tid_map_files_dentry_operations);
22812281
}
22822282

22832283
static struct dentry *proc_map_files_lookup(struct inode *dir,

0 commit comments

Comments
 (0)