Skip to content

ovl: add override_creds mount option

Christian Brauner linux-fsdevel linux-unionfs 3 versions – In review

Get series with b4
b4 am [email protected] change-id 20250214-work-overlayfs-dfcfc4cd7ebd

Versions newest first

  1. v3 Latest4 patches 5 repliesIn review
  2. v2 RFC2 patches 2 repliesSuperseded
  3. v1 RFC2 patches 1 replySuperseded

Changes in v3 from the cover letter

- Extended selftests.
- Allowed all user descendant namespaces.
- Link to v2: https://lore.kernel.org/r/[email protected]

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4ovl: allow to specify override credentialsDocumentation/filesystems/overlayfs.rst fs/overlayfs/params.c fs/overlayfs/super.c+59 -62 replies
2/4selftests/ovl: add first selftest for "override_creds"tools/testing/selftests/filesystems/overlayfs/set_layers_via_fds.c+101 -00 replies
3/4selftests/ovl: add second selftest for "override_creds"tools/testing/selftests/filesystems/overlayfs/Makefile tools/testing/selftests/filesystems/overlayfs/set_layers_via_fds.c tools/testing/selftests/filesystems/utils.c +1 more+665 -132 replies
4/4selftests/ovl: add third selftest for "override_creds"tools/testing/selftests/filesystems/overlayfs/set_layers_via_fds.c tools/testing/selftests/filesystems/utils.c tools/testing/selftests/filesystems/utils.h+108 -01 reply

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchAmir Goldstein
1/4R-b
2/4R-b
3/4R-b
4/4R-b

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

Read the v3 thread

Cover letter [PATCH v3 0/4] ovl: add override_creds mount option

Hey,

Currently overlayfs uses the mounter's credentials for it's override_creds() calls. That provides a consistent permission model.

This patches allows a caller to instruct overlayfs to use its credentials instead. The caller must be located in the same user namespace hierarchy as the user namespace the overlayfs instance will be mounted in. This provides a consistent and simple security model.

With this it is possible to e.g., mount an overlayfs instance where the mounter must have CAP_SYS_ADMIN but the credentials used for override_creds() have dropped CAP_SYS_ADMIN. It also allows the usage of custom fs{g,u}id different from the callers and other tweaks.

Thanks!
Christian

---
Changes in v3:
- Extended selftests.
- Allowed all user descendant namespaces.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Added new section to overlayfs Documentation.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Christian Brauner (4):
ovl: allow to specify override credentials selftests/ovl: add first selftest for "override_creds" selftests/ovl: add second selftest for "override_creds" selftests/ovl: add third selftest for "override_creds"

 Documentation/filesystems/overlayfs.rst            |  24 +-
 fs/overlayfs/params.c                              |  25 +
 fs/overlayfs/super.c                               |  16 +-
 .../selftests/filesystems/overlayfs/Makefile       |  11 +-
 .../filesystems/overlayfs/set_layers_via_fds.c     | 312 ++++++++++++-
 tools/testing/selftests/filesystems/utils.c        | 501 +++++++++++++++++++++
 tools/testing/selftests/filesystems/utils.h        |  45 ++
 7 files changed, 924 insertions(+), 10 deletions(-)

---
base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b
change-id: 20250214-work-overlayfs-dfcfc4cd7ebd