From: Christian Brauner <brauner@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>,
linux-fsdevel@vger.kernel.org
Cc: Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
Aleksa Sarai <cyphar@cyphar.com>,
Christian Brauner <brauner@kernel.org>
Subject: [PATCH RFC 5/6] proc: block mounting on top of /proc/<pid>/fd/*
Date: Tue, 06 Aug 2024 18:02:31 +0200 [thread overview]
Message-ID: <20240806-work-procfs-v1-5-fb04e1d09f0c@kernel.org> (raw)
In-Reply-To: <20240806-work-procfs-v1-0-fb04e1d09f0c@kernel.org>
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.
Signed-off-by: Christian Brauner <brauner@kernel.org>
---
fs/proc/fd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index ab243caf1b71..f6b7344b9b2e 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,
--
2.43.0
next prev parent reply other threads:[~2024-08-06 16:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-06 16:02 [PATCH RFC 0/6] proc: restrict overmounting of ephemeral entities Christian Brauner
2025-09-30 8:53 ` Petr Vorel
2024-08-06 16:02 ` [PATCH RFC 1/6] proc: proc_readfd() -> proc_fd_iterate_shared() Christian Brauner
2024-08-06 17:06 ` Linus Torvalds
2024-08-06 16:02 ` [PATCH RFC 2/6] proc: proc_readfdinfo() -> proc_fdinfo_iterate_shared() Christian Brauner
2024-08-06 16:02 ` [PATCH RFC 3/6] proc: add proc_splice_unmountable() Christian Brauner
2024-08-06 16:02 ` [PATCH RFC 4/6] proc: block mounting on top of /proc/<pid>/map_files/* Christian Brauner
2024-08-06 16:02 ` Christian Brauner [this message]
2024-08-06 16:02 ` [PATCH RFC 6/6] proc: block mounting on top of /proc/<pid>/fdinfo/* Christian Brauner
2024-08-07 14:33 ` [PATCH RFC 0/6] proc: restrict overmounting of ephemeral entities Josef Bacik
2025-09-30 15:51 ` Aleksa Sarai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240806-work-procfs-v1-5-fb04e1d09f0c@kernel.org \
--to=brauner@kernel.org \
--cc=cyphar@cyphar.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.