[Devel] [PATCH vz9 4/6] proc: block mounting on top of /proc/<pid>/map_files/*

Vasileios Almpanis vasileios.almpanis at virtuozzo.com
Thu Jan 8 12:17:17 MSK 2026


From: Christian Brauner <brauner at kernel.org>

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 at toxicpanda.com>
Signed-off-by: Christian Brauner <brauner at kernel.org>
(cherry picked from commit d0acba925215237d3ab6307513a86e1071a29e4d)

https://virtuozzo.atlassian.net/browse/VSTOR-121919
Signed-off-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>
---
 fs/proc/base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 13c6130f3116..c18155233dc5 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2375,8 +2375,8 @@ proc_map_files_instantiate(struct dentry *dentry,
 	inode->i_op = &proc_map_files_link_inode_operations;
 	inode->i_size = 64;
 
-	d_set_d_op(dentry, &tid_map_files_dentry_operations);
-	return d_splice_alias(inode, dentry);
+	return proc_splice_unmountable(inode, dentry,
+				       &tid_map_files_dentry_operations);
 }
 
 static struct dentry *proc_map_files_lookup(struct inode *dir,
-- 
2.43.0



More information about the Devel mailing list