Skip to content

proc: subset=pid: Relax check of mount visibility

Alexey Gladkov containers linux-fsdevel lkml 4 versions – Applied

Status from this message: Applied to the vfs-7.2.procfs branch of the vfs/vfs.git tree.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v10 Latest7 patches 3 repliesApplied
  2. v95 patches 9 repliesSuperseded
  3. v85 patches 4 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v75 patches2 repliesSuperseded

Changes in v10 from the cover letter

* Rework visibility checks around Christian's FS_USERNS_MOUNT_RESTRICTED and SB_I_RESTRICTED_VARIANT approach instead of fs_context skip_visibility.
* Add Christian's sysfs_get_tree() cleanup.
* Treat subset=pid procfs as a restricted variant that is allowed without mnt_already_visible(), but cannot be used as visibility evidence for later mounts.
* Forbid changing subset=pid on procfs reconfigure in either direction to avoid exposing pre-existing overmounts after switching to subset=pid.
* Make failed subset=pid reconfigure leave other procfs options unchanged.
* Update procfs documentation accordingly.

Patches in v10 Applied

#Subject and filesSizeRepliesApplied
1/7namespace: record fully visible mounts in listfs/mount.h fs/namespace.c+15 -80 replies
2/7fs: move SB_I_USERNS_VISIBLE to FS_USERNS_MOUNT_RESTRICTEDfs/namespace.c fs/proc/root.c fs/sysfs/mount.c +3 more+8 -100 replies
3/7sysfs: remove trivial sysfs_get_tree() wrapperfs/sysfs/mount.c+1 -130 replies
4/7proc: subset=pid: Show /proc/self/net only for CAP_NET_ADMINfs/proc/proc_net.c fs/proc/root.c include/linux/proc_fs.h+11 -00 replies
5/7proc: prevent reconfiguring subset=pidfs/proc/root.c+11 -41 reply
6/7proc: handle subset=pid separately in userns visibility checksfs/namespace.c fs/proc/root.c include/linux/fs/super_types.h+20 -10 replies
7/7docs: proc: add documentation about mount restrictionsDocumentation/filesystems/proc.rst+18 -10 replies

Reviews trailers per patch

None of the 7 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchAleksa Sarai
SeriesR-b
1/7
2/7
3/7
4/7
5/7
6/7
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v10 thread

Cover letter [PATCH v10 0/7] proc: subset=pid: Relax check of mount visibility

When mounting procfs with the subset=pids option, all static files become unavailable and only the dynamic part with information about pids is accessible.

In this case, there is no point in imposing additional restrictions on the visibility of the entire filesystem for the mounter. Everything that can be hidden in procfs is already inaccessible.

Currently, these restrictions prevent pidfs from being mounted inside rootless containers, as almost all container implementations override part of procfs to hide certain directories. Relaxing these restrictions will allow pidfs to be used in nested containerization.

---
Changelog
---------
v10:
* Rework visibility checks around Christian's FS_USERNS_MOUNT_RESTRICTED and SB_I_RESTRICTED_VARIANT approach instead of fs_context skip_visibility.
* Add Christian's sysfs_get_tree() cleanup.
* Treat subset=pid procfs as a restricted variant that is allowed without mnt_already_visible(), but cannot be used as visibility evidence for later mounts.
* Forbid changing subset=pid on procfs reconfigure in either direction to avoid exposing pre-existing overmounts after switching to subset=pid.
* Make failed subset=pid reconfigure leave other procfs options unchanged.
* Update procfs documentation accordingly.

v9:
* Rework the patch based on the one proposed by Christian Brauner.

v8:
* Remove mounter credential change on remount as suggested by Christian Brauner.

v7:
* Rebase on v6.19-rc5.
* Rename SB_I_DYNAMIC to SB_I_USERNS_ALLOW_REVEALING.

v6:
* Add documentation about procfs mount restrictions.
* Reorder commits for better review.

v4:
* Set SB_I_DYNAMIC only if pidonly is set.
* Add an error message if subset=pid is canceled during remount.

v3:
* Add 'const' to struct cred *mounter_cred (fix kernel test robot warning).

v2:
* cache the mounters credentials and make access to the net directories contingent of the permissions of the mounter of procfs.

Alexey Gladkov (4):
proc: subset=pid: Show /proc/self/net only for CAP_NET_ADMIN
proc: prevent reconfiguring subset=pid
proc: handle subset=pid separately in userns visibility checks
docs: proc: add documentation about mount restrictions

Christian Brauner (3):
namespace: record fully visible mounts in list
fs: move SB_I_USERNS_VISIBLE to FS_USERNS_MOUNT_RESTRICTED
sysfs: remove trivial sysfs_get_tree() wrapper

 Documentation/filesystems/proc.rst | 19 ++++++++++++++++-
 fs/mount.h                         |  4 ++++
 fs/namespace.c                     | 34 +++++++++++++++++++++++-------
 fs/proc/proc_net.c                 |  8 +++++++
 fs/proc/root.c                     | 24 +++++++++++++++------
 fs/sysfs/mount.c                   | 18 ++--------------
 include/linux/fs.h                 |  1 +
 include/linux/fs/super_types.h     |  2 +-
 include/linux/proc_fs.h            |  1 +
 kernel/acct.c                      |  2 +-
 10 files changed, 80 insertions(+), 33 deletions(-)
Signature · 1 line
2.54.0