Linux filesystem development
 help / color / mirror / Atom feed
* [PATCH 0/2] namespace: allow bind mounts of ephemeral procfs files again
@ 2026-11-26 11:40 Christian Brauner
  2026-11-26 11:40 ` [PATCH 1/2] " Christian Brauner
  2026-11-26 11:40 ` [PATCH 2/2] selftests/filesystems: check that ephemeral procfs files can be bind-mounted Christian Brauner
  0 siblings, 2 replies; 7+ messages in thread
From: Christian Brauner @ 2026-11-26 11:40 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Alexander Viro, Jan Kara, Aleksa Sarai,
	Christian Brauner (Amutable), stable

Bind-mounting of files in /proc/<pid>/{fd,fdinfo,map_files} and below
/proc/<pid>/net got broken with commit 75f4197f1e11 ("dcache: don't put
a mountpoint on a dentry that's being removed").

procfs calls dont_mount() on these files so nothing can be mounted on
top of them. But attach_recursive_mnt() makes a mountpoint out of the
root of every source in case it goes beneath a mount. So bind-mounting
one of them fails with ENOENT now. libpathrs does exactly that in its
tests and it's broken in stable too.

Only refuse such a root when the source or one of its copies would go
beneath a mount. The race the original commit closed stays closed. The
selftest checks that these files can be bind-mounted but still can't be
mounted on.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
---
Christian Brauner (2):
      namespace: allow bind mounts of ephemeral procfs files again
      selftests/filesystems: check that ephemeral procfs files can be bind-mounted

 fs/dcache.c                                        |   5 +-
 fs/namespace.c                                     |  25 ++
 fs/pnode.c                                         |   6 +
 fs/pnode.h                                         |   2 +
 .../selftests/filesystems/mount_cycle/.gitignore   |   1 +
 .../selftests/filesystems/mount_cycle/Makefile     |   2 +-
 .../filesystems/mount_cycle/procfs_source_test.c   | 283 +++++++++++++++++++++
 7 files changed, 320 insertions(+), 4 deletions(-)
---
base-commit: 2dc60bd9975fc8666a13d58410499e06e6799ba9
change-id: 20261125-work-mount-cant_mount-6d744b18a9d0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-11-27  8:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 11:40 [PATCH 0/2] namespace: allow bind mounts of ephemeral procfs files again Christian Brauner
2026-11-26 11:40 ` [PATCH 1/2] " Christian Brauner
2026-11-27  8:22   ` Alexander Mikhalitsyn
2026-11-27  8:53     ` Christian Brauner
2026-11-27  8:58   ` Alexander Mikhalitsyn
2026-11-26 11:40 ` [PATCH 2/2] selftests/filesystems: check that ephemeral procfs files can be bind-mounted Christian Brauner
2026-11-27  8:24   ` Alexander Mikhalitsyn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox