Skip to content

overlayfs override_creds=off & nested get xattr fix

Mark Salyzyn linux-doc linux-fsdevel linux-security-module linux-unionfs lkml selinux 15 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v18 Latest posting 2/24 patches 6 repliesIn review
  2. v18 posting 1/24 patches 2 repliesSuperseded
  3. v174 patches 5 repliesSuperseded
Earlier versions · 12
VersionPostedPatchesRepliesStatus
v164 patches1 replySuperseded
v15 posting 2/20 of 4 patches0 repliesSuperseded
v15 posting 1/24 patches5 repliesSuperseded
v145 patches12 repliesSuperseded
v81 patch6 repliesSuperseded
v71 patch3 repliesSuperseded
v61 patch0 repliesSuperseded
v51 patch0 repliesSuperseded
v41 patch2 repliesSuperseded
v31 patch0 repliesSuperseded
v21 patch3 repliesSuperseded
v11 patch8 repliesSuperseded

v14 from the cover letter

- Rejoin, rebase and a few adjustments.

Patches in v18 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4Add flags option to get xattr method paired to __vfs_getxattrDocumentation/filesystems/locking.rst fs/9p/acl.c fs/9p/xattr.c +47 more+134 -900 replies
2/4overlayfs: handle XATTR_NOSECURITY flag for get xattr methodfs/overlayfs/inode.c fs/overlayfs/overlayfs.h fs/overlayfs/super.c+9 -64 replies
3/4overlayfs: override_creds=off option bypass creator_credDocumentation/filesystems/overlayfs.rst fs/overlayfs/copy_up.c fs/overlayfs/dir.c +8 more+98 -400 replies
4/4overlayfs: inode_owner_or_capable called during execvfs/overlayfs/file.c+1 -10 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchJan KaraJeff LaytonDavid SterbaDarrick J. WongMike Marshall
1/4R-b A-b A-b A-b A-b A-b
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v18 thread

Cover letter [RESEND PATCH v18 0/4] overlayfs override_creds=off & nested get xattr fix

Mark Salyzyn (3):
Add flags option to get xattr method paired to __vfs_getxattr
overlayfs: handle XATTR_NOSECURITY flag for get xattr method
overlayfs: override_creds=off option bypass creator_cred

Mark Salyzyn + John Stultz (1):
overlayfs: inode_owner_or_capable called during execv

The first three patches address fundamental security issues that should be solved regardless of the override_creds=off feature.

The fourth adds the feature depends on these other fixes.

By default, all access to the upper, lower and work directories is the recorded mounter's MAC and DAC credentials. The incoming accesses are checked against the caller's credentials.

If the principles of least privilege are applied for sepolicy, the mounter's credentials might not overlap the credentials of the caller's when accessing the overlayfs filesystem. For example, a file that a lower DAC privileged caller can execute, is MAC denied to the generally higher DAC privileged mounter, to prevent an attack vector.

We add the option to turn off override_creds in the mount options; all subsequent operations after mount on the filesystem will be only the caller's credentials. The module boolean parameter and mount option override_creds is also added as a presence check for this "feature", existence of /sys/module/overlay/parameters/overlay_creds

---

v18
- rebase + fix minor cut and paste error for inode argument in __vfs_getxattr

v17
- correct some zero-day build failures.
- fix up documentation

v16
- rebase and merge of two patches.
- add adjustment to deal with execv when overrides is off.

v15
- Revert back to v4 with fixes from on the way from v5-v14. The single structure argument passing to address the complaints about too many arguments was rejected by the community.
- Drop the udner discussion fix for an additional CAP_DAC_READ_SEARCH check. Can address that independently.
- ToDo: upstream test frame for thes security fixes (currently testing is all in Android).

v14:
- Rejoin, rebase and a few adjustments.

v13:
- Pull out first patch and try to get it in alone feedback, some Acks, and then <crickets> because people forgot why we were doing i.

v12:
- Restore squished out patch 2 and 3 in the series, then change algorithm to add flags argument. Per-thread flag is a large security surface.

v11:
- Squish out v10 introduced patch 2 and 3 in the series, then and use per-thread flag instead for nesting.
- Switch name to ovl_do_vds_getxattr for __vds_getxattr wrapper.
- Add sb argument to ovl_revert_creds to match future work.

v10:
- Return NULL on CAP_DAC_READ_SEARCH
- Add __get xattr method to solve sepolicy logging issue
- Drop unnecessary sys_admin sepolicy checking for administrative driver internal xattr functions.

v6:
- Drop CONFIG_OVERLAY_FS_OVERRIDE_CREDS.
- Do better with the documentation, drop rationalizations.
- pr_warn message adjusted to report consequences.

v5:
- beefed up the caveats in the Documentation
- Is dependent on
"overlayfs: check CAP_DAC_READ_SEARCH before issuing exportfs_decode_fh" "overlayfs: check CAP_MKNOD before issuing vfs_whiteout"
- Added prwarn when override_creds=off

v4:
- spelling and grammar errors in text

v3:
- Change name from caller_credentials / creator_credentials to the boolean override_creds.
- Changed from creator to mounter credentials.
- Updated and fortified the documentation.
- Added CONFIG_OVERLAY_FS_OVERRIDE_CREDS

v2:
- Forward port changed attr to stat, resulting in a build error.
- altered commit message.

 Documentation/filesystems/locking.rst   |  2 +-
 Documentation/filesystems/overlayfs.rst | 26 +++++++++++++++++-
 fs/9p/acl.c                             |  3 ++-
 fs/9p/xattr.c                           |  3 ++-
 fs/afs/xattr.c                          | 10 +++----
 fs/btrfs/xattr.c                        |  3 ++-
 fs/ceph/xattr.c                         |  3 ++-
 fs/cifs/xattr.c                         |  2 +-
 fs/ecryptfs/inode.c                     |  6 +++--
 fs/ecryptfs/mmap.c                      |  2 +-
 fs/erofs/xattr.c                        |  3 ++-
 fs/ext2/xattr_security.c                |  2 +-
 fs/ext2/xattr_trusted.c                 |  2 +-
 fs/ext2/xattr_user.c                    |  2 +-
 fs/ext4/xattr_hurd.c                    |  2 +-
 fs/ext4/xattr_security.c                |  2 +-
 fs/ext4/xattr_trusted.c                 |  2 +-
 fs/ext4/xattr_user.c                    |  2 +-
 fs/f2fs/xattr.c                         |  4 +--
 fs/fuse/xattr.c                         |  4 +--
 fs/gfs2/xattr.c                         |  3 ++-
 fs/hfs/attr.c                           |  2 +-
 fs/hfsplus/xattr.c                      |  3 ++-
 fs/hfsplus/xattr_security.c             |  3 ++-
 fs/hfsplus/xattr_trusted.c              |  3 ++-
 fs/hfsplus/xattr_user.c                 |  3 ++-
 fs/jffs2/security.c                     |  3 ++-
 fs/jffs2/xattr_trusted.c                |  3 ++-
 fs/jffs2/xattr_user.c                   |  3 ++-
 fs/jfs/xattr.c                          |  5 ++--
 fs/kernfs/inode.c                       |  3 ++-
 fs/nfs/nfs4proc.c                       |  9 ++++---
 fs/ocfs2/xattr.c                        |  9 ++++---
 fs/orangefs/xattr.c                     |  3 ++-
 fs/overlayfs/copy_up.c                  |  2 +-
 fs/overlayfs/dir.c                      | 17 +++++++-----
 fs/overlayfs/file.c                     | 26 +++++++++---------
 fs/overlayfs/inode.c                    | 23 ++++++++--------
 fs/overlayfs/namei.c                    |  6 ++---
 fs/overlayfs/overlayfs.h                |  7 +++--
 fs/overlayfs/ovl_entry.h                |  1 +
 fs/overlayfs/readdir.c                  |  8 +++---
 fs/overlayfs/super.c                    | 34 ++++++++++++++++++-----
 fs/overlayfs/util.c                     | 13 +++++++--
 fs/posix_acl.c                          |  2 +-
 fs/reiserfs/xattr_security.c            |  3 ++-
 fs/reiserfs/xattr_trusted.c             |  3 ++-
 fs/reiserfs/xattr_user.c                |  3 ++-
 fs/squashfs/xattr.c                     |  2 +-
 fs/ubifs/xattr.c                        |  3 ++-
 fs/xattr.c                              | 36 ++++++++++++-------------
 fs/xfs/xfs_xattr.c                      |  3 ++-
 include/linux/xattr.h                   |  9 ++++---
 include/uapi/linux/xattr.h              |  7 +++--
 mm/shmem.c                              |  3 ++-
 net/socket.c                            |  3 ++-
 security/commoncap.c                    |  6 +++--
 security/integrity/evm/evm_main.c       |  3 ++-
 security/selinux/hooks.c                | 11 +++++---
 security/smack/smack_lsm.c              |  5 ++--
 60 files changed, 242 insertions(+), 137 deletions(-)
Signature · 1 line
2.29.0.rc1.297.gfa9743e501-goog