Skip to content

Overlayfs fixes from Chris Mason (batch 1)

Amir Goldstein fuse-devel linux-fsdevel linux-unionfs stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 of 16 patches 1 replyIn review

9 of 16 patches are in this archive. The cover letter announces 16.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/16ovl: do not copy up an xattr value that was never readfs/overlayfs/copy_up.c+5 -10 replies
2/16ovl: fortify ovl_copy_xattr() against underlying layer modificationsfs/overlayfs/copy_up.c+32 -360 replies
3/16ovl: set OVL_WHITEOUTS before publishing the upper dirfs/overlayfs/copy_up.c fs/overlayfs/readdir.c+3 -20 replies
4/16ovl: add assertions in dir cache codefs/overlayfs/readdir.c+23 -20 replies
5/16ovl: check that the parents of volatile/dirty are dirsfs/overlayfs/super.c+9 -40 replies
6/16ovl: take a snapshot of the name for copy upfs/overlayfs/copy_up.c+12 -60 replies
7/16vfs: add try_take_dentry_name_snapshot()fs/dcache.c include/linux/dcache.h+27 -30 replies
8/16ovl: do not take a name snapshot in RCU walkfs/overlayfs/super.c+7 -10 replies
9/16ovl: use the pinned upper dir in ovl_fix_origin()fs/overlayfs/namei.c fs/overlayfs/overlayfs.h+10 -20 replies

Reviews trailers per patch

None of the 9 patches has a Reviewed-by or Acked-by.

PatchFahad Alharbi
1/16
2/16T-b
3/16
4/16
5/16
6/16
7/16
8/16
9/16

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

Read the v1 thread

Cover letter [PATCH 00/16] Overlayfs fixes from Chris Mason (batch 1)

Hi folks,

The following batch of patches is part of a collection of overlayfs bugs reported by Chris Mason.

These bugs were found by Chris' AI code scanner (kres), but underwent extensive manual auditing and filtering by both Chris and Josef.

I thank them both for handing me a reasonably sized pile of patches, most of them important, correct and ready to merge.

The patches selected in this batch were either simple enough to merge without questions or important enough for me to invest the extra time.

Patches that I changed include a note [amir: ...] with my changes above my signature.

Notable changes from Chris' version:
- Include "fortify ovl_copy_xattr()" and "assertions in dir cache" patches already posted publicly for similar reported issues
- Use LOOKUP_EXCL in "do not copy up a dentry that was removed"
- Add vfs helper try_take_dentry_name_snapshot() instead of open coding it in overlayfs code
- Fix for empty security.capability from Josef adjusted and rebased onto "fortify ovl_copy_xattr()" refactoring

This pile applies cleanly and was tested on top of 7.3 and on top of master of the moment.

Backports down to 6.1.y are either trivial or already prepared in my local tree. I will make those available to the stable maintainers after upstream merge.

PR will follow soon.

Thanks,
Amir.

Amir Goldstein (4):
ovl: fortify ovl_copy_xattr() against underlying layer modifications
ovl: add assertions in dir cache code
vfs: add try_take_dentry_name_snapshot()
ovl: skip copy up of empty security.capability

Chris Mason (12):
ovl: do not copy up an xattr value that was never read
ovl: set OVL_WHITEOUTS before publishing the upper dir
ovl: check that the parents of volatile/dirty are dirs
ovl: take a snapshot of the name for copy up
ovl: do not take a name snapshot in RCU walk
ovl: use the pinned upper dir in ovl_fix_origin()
ovl: hold a reference on the parent in readdir
ovl: do not copy up a dentry that was removed
ovl: fix a torn path in ovl_get_redirect()
ovl: read the nlink xattr of every indexed non-dir
ovl: always encode the origin fh when index is enabled
ovl: set the revalidate flags after d_instantiate()

 fs/dcache.c              |  29 +++++++++--
 fs/overlayfs/copy_up.c   | 110 ++++++++++++++++++++++++---------------
 fs/overlayfs/dir.c       |  22 +++++++-
 fs/overlayfs/inode.c     |  14 +++--
 fs/overlayfs/namei.c     |   8 +--
 fs/overlayfs/overlayfs.h |   8 ++-
 fs/overlayfs/readdir.c   |  61 ++++++++++++++++++----
 fs/overlayfs/super.c     |  21 ++++++--
 include/linux/dcache.h   |   1 +
 9 files changed, 203 insertions(+), 71 deletions(-)
Signature · 1 line
2.55.0