1. 26 Oct, 2018 8 commits
    • Amir Goldstein's avatar
      ovl: relax requirement for non null uuid of lower fs · 9df085f3
      Amir Goldstein authored
      We use uuid to associate an overlay lower file handle with a lower layer,
      so we can accept lower fs with null uuid as long as all lower layers with
      null uuid are on the same fs.
      
      This change allows enabling index and nfs_export features for the setup of
      single lower fs of type squashfs - squashfs supports file handles, but has
      a null uuid. This change also allows enabling index and nfs_export features
      for nested overlayfs, where the lower overlay has nfs_export enabled.
      
      Enabling the index feature with single lower squashfs fixes the
      unionmount-testsuite test:
        ./run --ov --squashfs --verify
      
      As a by-product, if, like the lower squashfs, upper fs also uses the
      generic export_encode_fh() implementation to export 32bit inode file
      handles (e.g. ext4), then the xino_auto config/module/mount option will
      enable unique overlay inode numbers.
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      9df085f3
    • Miklos Szeredi's avatar
      ovl: fold copy-up helpers into callers · 6b52243f
      Miklos Szeredi authored
      Now that the workdir and tmpfile copy up modes have been untagled, the
      functions become simple enough that the helpers can be folded into the
      callers.
      
      Add new helpers where there is any duplication remaining: preparing creds
      for creating the object.
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      6b52243f
    • Amir Goldstein's avatar
      ovl: untangle copy up call chain · b10cdcdc
      Amir Goldstein authored
      In an attempt to dedup ~100 LOC, we ended up creating a tangled call chain,
      whose branches merge and diverge in several points according to the
      immutable c->tmpfile copy up mode.
      
      This call chain was hard to analyse for locking correctness because the
      locking requirements for the c->tmpfile flow were very different from the
      locking requirements for the !c->tmpfile flow (i.e. directory vs.  regulare
      file copy up).
      
      Split the copy up helpers of the c->tmpfile flow from those of the
      !c->tmpfile (i.e. workdir) flow and remove the c->tmpfile mode from copy up
      context.
      Suggested-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      b10cdcdc
    • Miklos Szeredi's avatar
      ovl: relax permission checking on underlying layers · 007ea448
      Miklos Szeredi authored
      Make permission checking more consistent:
      
       - special files don't need any access check on underling fs
      
       - exec permission check doesn't need to be performed on underlying fs
      Reported-by: default avatar"J. Bruce Fields" <bfields@fieldses.org>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      007ea448
    • Amir Goldstein's avatar
      ovl: fix recursive oi->lock in ovl_link() · 6cd07870
      Amir Goldstein authored
      linking a non-copied-up file into a non-copied-up parent results in a
      nested call to mutex_lock_interruptible(&oi->lock). Fix this by copying up
      target parent before ovl_nlink_start(), same as done in ovl_rename().
      
      ~/unionmount-testsuite$ ./run --ov -s
      ~/unionmount-testsuite$ ln /mnt/a/foo100 /mnt/a/dir100/
      
       WARNING: possible recursive locking detected
       --------------------------------------------
       ln/1545 is trying to acquire lock:
       00000000bcce7c4c (&ovl_i_lock_key[depth]){+.+.}, at:
           ovl_copy_up_start+0x28/0x7d
       but task is already holding lock:
       0000000026d73d5b (&ovl_i_lock_key[depth]){+.+.}, at:
           ovl_nlink_start+0x3c/0xc1
      
      [SzM: this seems to be a false positive, but doing the copy-up first is
      harmless and removes the lockdep splat]
      
      Reported-by: syzbot+3ef5c0d1a5cb0b21e6be@syzkaller.appspotmail.com
      Fixes: 5f8415d6 ("ovl: persistent overlay inode nlink for...")
      Cc: <stable@vger.kernel.org> # v4.13
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      6cd07870
    • Amir Goldstein's avatar
      vfs: fix FIGETBSZ ioctl on an overlayfs file · 8f97d1e9
      Amir Goldstein authored
      Some anon_bdev filesystems (e.g. overlayfs, ceph) don't have s_blocksize
      set. Returning zero from FIGETBSZ ioctl results in a Floating point
      exception from the e2fsprogs utility filefrag, which divides the size of
      the file with the value returned by FIGETBSZ.
      
      Fix the interface by returning -EINVAL for these filesystems.
      
      Fixes: d1d04ef8 ("ovl: stack file ops")
      Cc: <stable@vger.kernel.org> # v4.19
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      8f97d1e9
    • Miklos Szeredi's avatar
      ovl: clean up error handling in ovl_get_tmpfile() · 1f244dc5
      Miklos Szeredi authored
      If security_inode_copy_up() fails, it should not set new_creds, so no need
      for the cleanup (which would've Oops-ed anyway, due to old_creds being
      NULL).
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      1f244dc5
    • Amir Goldstein's avatar
      ovl: fix error handling in ovl_verify_set_fh() · babf4770
      Amir Goldstein authored
      We hit a BUG on kfree of an ERR_PTR()...
      
      Reported-by: syzbot+ff03fe05c717b82502d0@syzkaller.appspotmail.com
      Fixes: 8b88a2e6 ("ovl: verify upper root dir matches lower root dir")
      Cc: <stable@vger.kernel.org> # v4.13
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      babf4770
  2. 22 Oct, 2018 8 commits
  3. 21 Oct, 2018 3 commits
  4. 20 Oct, 2018 11 commits
  5. 19 Oct, 2018 10 commits