1. 16 5月, 2023 3 次提交
  2. 08 3月, 2023 1 次提交
  3. 18 11月, 2022 1 次提交
  4. 26 10月, 2022 1 次提交
  5. 17 3月, 2022 1 次提交
  6. 14 1月, 2022 3 次提交
  7. 30 11月, 2021 1 次提交
  8. 15 11月, 2021 3 次提交
  9. 21 10月, 2021 1 次提交
  10. 19 10月, 2021 2 次提交
  11. 03 6月, 2021 4 次提交
  12. 09 3月, 2021 6 次提交
    • M
      ovl: expand warning in ovl_d_real() · f39d31c6
      Miklos Szeredi 提交于
      stable inclusion
      from stable-5.10.17
      commit e5c376c41a5798451355fb2e0732847be4a64c58
      bugzilla: 48169
      
      --------------------------------
      
      commit cef4cbff upstream.
      
      There was a syzbot report with this warning but insufficient information...
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      f39d31c6
    • A
      ovl: skip getxattr of security labels · 48bc3e4d
      Amir Goldstein 提交于
      stable inclusion
      from stable-5.10.17
      commit 116826d615c1936dff40a7766374733078e43803
      bugzilla: 48169
      
      --------------------------------
      
      [ Upstream commit 03fedf93 ]
      
      When inode has no listxattr op of its own (e.g. squashfs) vfs_listxattr
      calls the LSM inode_listsecurity hooks to list the xattrs that LSMs will
      intercept in inode_getxattr hooks.
      
      When selinux LSM is installed but not initialized, it will list the
      security.selinux xattr in inode_listsecurity, but will not intercept it
      in inode_getxattr.  This results in -ENODATA for a getxattr call for an
      xattr returned by listxattr.
      
      This situation was manifested as overlayfs failure to copy up lower
      files from squashfs when selinux is built-in but not initialized,
      because ovl_copy_xattr() iterates the lower inode xattrs by
      vfs_listxattr() and vfs_getxattr().
      
      ovl_copy_xattr() skips copy up of security labels that are indentified by
      inode_copy_up_xattr LSM hooks, but it does that after vfs_getxattr().
      Since we are not going to copy them, skip vfs_getxattr() of the security
      labels.
      Reported-by: NMichael Labriola <michael.d.labriola@gmail.com>
      Tested-by: NMichael Labriola <michael.d.labriola@gmail.com>
      Link: https://lore.kernel.org/linux-unionfs/2nv9d47zt7.fsf@aldarion.sourceruckus.org/Signed-off-by: NAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      48bc3e4d
    • M
      ovl: perform vfs_getxattr() with mounter creds · 65d7cc94
      Miklos Szeredi 提交于
      stable inclusion
      from stable-5.10.17
      commit cbb9404a50521cdee71346d162b72d3cde270b9e
      bugzilla: 48169
      
      --------------------------------
      
      [ Upstream commit 554677b9 ]
      
      The vfs_getxattr() in ovl_xattr_set() is used to check whether an xattr
      exist on a lower layer file that is to be removed.  If the xattr does not
      exist, then no need to copy up the file.
      
      This call of vfs_getxattr() wasn't wrapped in credential override, and this
      is probably okay.  But for consitency wrap this instance as well.
      Reported-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      65d7cc94
    • S
      ovl: implement volatile-specific fsync error behaviour · 05fd80bb
      Sargun Dhillon 提交于
      stable inclusion
      from stable-5.10.15
      commit 8ccf963c6227ff1feb2db6b1bdcb5243f7f38067
      bugzilla: 48167
      
      --------------------------------
      
      commit 335d3fc5 upstream.
      
      Overlayfs's volatile option allows the user to bypass all forced sync calls
      to the upperdir filesystem. This comes at the cost of safety. We can never
      ensure that the user's data is intact, but we can make a best effort to
      expose whether or not the data is likely to be in a bad state.
      
      The best way to handle this in the time being is that if an overlayfs's
      upperdir experiences an error after a volatile mount occurs, that error
      will be returned on fsync, fdatasync, sync, and syncfs. This is
      contradictory to the traditional behaviour of VFS which fails the call
      once, and only raises an error if a subsequent fsync error has occurred,
      and been raised by the filesystem.
      
      One awkward aspect of the patch is that we have to manually set the
      superblock's errseq_t after the sync_fs callback as opposed to just
      returning an error from syncfs. This is because the call chain looks
      something like this:
      
      sys_syncfs ->
      	sync_filesystem ->
      		__sync_filesystem ->
      			/* The return value is ignored here
      			sb->s_op->sync_fs(sb)
      			_sync_blockdev
      		/* Where the VFS fetches the error to raise to userspace */
      		errseq_check_and_advance
      
      Because of this we call errseq_set every time the sync_fs callback occurs.
      Due to the nature of this seen / unseen dichotomy, if the upperdir is an
      inconsistent state at the initial mount time, overlayfs will refuse to
      mount, as overlayfs cannot get a snapshot of the upperdir's errseq that
      will increment on error until the user calls syncfs.
      Signed-off-by: NSargun Dhillon <sargun@sargun.me>
      Suggested-by: NAmir Goldstein <amir73il@gmail.com>
      Reviewed-by: NAmir Goldstein <amir73il@gmail.com>
      Fixes: c86243b0 ("ovl: provide a mount option "volatile"")
      Cc: stable@vger.kernel.org
      Reviewed-by: NVivek Goyal <vgoyal@redhat.com>
      Reviewed-by: NJeff Layton <jlayton@kernel.org>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      05fd80bb
    • M
      ovl: avoid deadlock on directory ioctl · 7fd3afde
      Miklos Szeredi 提交于
      stable inclusion
      from stable-5.10.15
      commit a66f82a1de028878bb158cfaac178f3a710ebdeb
      bugzilla: 48167
      
      --------------------------------
      
      commit b854cc65 upstream.
      
      The function ovl_dir_real_file() currently uses the inode lock to serialize
      writes to the od->upperfile field.
      
      However, this function will get called by ovl_ioctl_set_flags(), which
      utilizes the inode lock too.  In this case ovl_dir_real_file() will try to
      claim a lock that is owned by a function in its call stack, which won't get
      released before ovl_dir_real_file() returns.
      
      Fix by replacing the open coded compare and exchange by an explicit atomic
      op.
      
      Fixes: 61536bed ("ovl: support [S|G]ETFLAGS and FS[S|G]ETXATTR ioctls for directories")
      Cc: stable@vger.kernel.org # v5.10
      Reported-by: NIcenowy Zheng <icenowy@aosc.io>
      Tested-by: NIcenowy Zheng <icenowy@aosc.io>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      7fd3afde
    • L
      ovl: fix dentry leak in ovl_get_redirect · ad6d51c6
      Liangyan 提交于
      stable inclusion
      from stable-5.10.15
      commit fb8caef7c020267ad30e868a5aeaa5da6ccf0c6e
      bugzilla: 48167
      
      --------------------------------
      
      commit e04527fe upstream.
      
      We need to lock d_parent->d_lock before dget_dlock, or this may
      have d_lockref updated parallelly like calltrace below which will
      cause dentry->d_lockref leak and risk a crash.
      
           CPU 0                                CPU 1
      ovl_set_redirect                       lookup_fast
        ovl_get_redirect                       __d_lookup
          dget_dlock
            //no lock protection here            spin_lock(&dentry->d_lock)
            dentry->d_lockref.count++            dentry->d_lockref.count++
      
      [   49.799059] PGD 800000061fed7067 P4D 800000061fed7067 PUD 61fec5067 PMD 0
      [   49.799689] Oops: 0002 [#1] SMP PTI
      [   49.800019] CPU: 2 PID: 2332 Comm: node Not tainted 4.19.24-7.20.al7.x86_64 #1
      [   49.800678] Hardware name: Alibaba Cloud Alibaba Cloud ECS, BIOS 8a46cfe 04/01/2014
      [   49.801380] RIP: 0010:_raw_spin_lock+0xc/0x20
      [   49.803470] RSP: 0018:ffffac6fc5417e98 EFLAGS: 00010246
      [   49.803949] RAX: 0000000000000000 RBX: ffff93b8da3446c0 RCX: 0000000a00000000
      [   49.804600] RDX: 0000000000000001 RSI: 000000000000000a RDI: 0000000000000088
      [   49.805252] RBP: 0000000000000000 R08: 0000000000000000 R09: ffffffff993cf040
      [   49.805898] R10: ffff93b92292e580 R11: ffffd27f188a4b80 R12: 0000000000000000
      [   49.806548] R13: 00000000ffffff9c R14: 00000000fffffffe R15: ffff93b8da3446c0
      [   49.807200] FS:  00007ffbedffb700(0000) GS:ffff93b927880000(0000) knlGS:0000000000000000
      [   49.807935] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   49.808461] CR2: 0000000000000088 CR3: 00000005e3f74006 CR4: 00000000003606a0
      [   49.809113] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [   49.809758] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [   49.810410] Call Trace:
      [   49.810653]  d_delete+0x2c/0xb0
      [   49.810951]  vfs_rmdir+0xfd/0x120
      [   49.811264]  do_rmdir+0x14f/0x1a0
      [   49.811573]  do_syscall_64+0x5b/0x190
      [   49.811917]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [   49.812385] RIP: 0033:0x7ffbf505ffd7
      [   49.814404] RSP: 002b:00007ffbedffada8 EFLAGS: 00000297 ORIG_RAX: 0000000000000054
      [   49.815098] RAX: ffffffffffffffda RBX: 00007ffbedffb640 RCX: 00007ffbf505ffd7
      [   49.815744] RDX: 0000000004449700 RSI: 0000000000000000 RDI: 0000000006c8cd50
      [   49.816394] RBP: 00007ffbedffaea0 R08: 0000000000000000 R09: 0000000000017d0b
      [   49.817038] R10: 0000000000000000 R11: 0000000000000297 R12: 0000000000000012
      [   49.817687] R13: 00000000072823d8 R14: 00007ffbedffb700 R15: 00000000072823d8
      [   49.818338] Modules linked in: pvpanic cirrusfb button qemu_fw_cfg atkbd libps2 i8042
      [   49.819052] CR2: 0000000000000088
      [   49.819368] ---[ end trace 4e652b8aa299aa2d ]---
      [   49.819796] RIP: 0010:_raw_spin_lock+0xc/0x20
      [   49.821880] RSP: 0018:ffffac6fc5417e98 EFLAGS: 00010246
      [   49.822363] RAX: 0000000000000000 RBX: ffff93b8da3446c0 RCX: 0000000a00000000
      [   49.823008] RDX: 0000000000000001 RSI: 000000000000000a RDI: 0000000000000088
      [   49.823658] RBP: 0000000000000000 R08: 0000000000000000 R09: ffffffff993cf040
      [   49.825404] R10: ffff93b92292e580 R11: ffffd27f188a4b80 R12: 0000000000000000
      [   49.827147] R13: 00000000ffffff9c R14: 00000000fffffffe R15: ffff93b8da3446c0
      [   49.828890] FS:  00007ffbedffb700(0000) GS:ffff93b927880000(0000) knlGS:0000000000000000
      [   49.830725] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   49.832359] CR2: 0000000000000088 CR3: 00000005e3f74006 CR4: 00000000003606a0
      [   49.834085] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [   49.835792] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      
      Cc: <stable@vger.kernel.org>
      Fixes: a6c60655 ("ovl: redirect on rename-dir")
      Signed-off-by: NLiangyan <liangyan.peng@linux.alibaba.com>
      Reviewed-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
      Suggested-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      ad6d51c6
  13. 12 1月, 2021 1 次提交
  14. 06 10月, 2020 2 次提交
  15. 02 9月, 2020 10 次提交
    • M
      ovl: rearrange ovl_can_list() · 8f6ee74c
      Miklos Szeredi 提交于
      ovl_can_list() should return false for overlay private xattrs.  Since
      currently these use the "trusted.overlay." prefix, they will always match
      the "trusted." prefix as well, hence the test for being non-trusted will
      not trigger.
      
      Prepare for using the "user.overlay." namespace by moving the test for
      private xattr before the test for non-trusted.
      
      This patch doesn't change behavior.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      8f6ee74c
    • M
      ovl: enumerate private xattrs · 43d193f8
      Miklos Szeredi 提交于
      Instead of passing the xattr name down to the ovl_do_*xattr() accessor
      functions, pass an enumerated value.  The enum can use the same names as
      the the previous #define for each xattr name.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      43d193f8
    • M
      ovl: pass ovl_fs down to functions accessing private xattrs · 610afc0b
      Miklos Szeredi 提交于
      This paves the way for optionally using the "user.overlay." xattr
      namespace.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      610afc0b
    • M
      ovl: drop flags argument from ovl_do_setxattr() · 26150ab5
      Miklos Szeredi 提交于
      All callers pass zero flags to ovl_do_setxattr().  So drop this argument.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      26150ab5
    • M
      ovl: adhere to the vfs_ vs. ovl_do_ conventions for xattrs · 71097047
      Miklos Szeredi 提交于
      Call ovl_do_*xattr() when accessing an overlay private xattr, vfs_*xattr()
      otherwise.
      
      This has an effect on debug output, which is made more consistent by this
      patch.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      71097047
    • M
      ovl: use ovl_do_getxattr() for private xattr · d5dc7486
      Miklos Szeredi 提交于
      Use the convention of calling ovl_do_foo() for operations which are overlay
      specific.
      
      This patch is a no-op, and will have significance for supporting
      "user.overlay." xattr namespace.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      d5dc7486
    • M
      ovl: fold ovl_getxattr() into ovl_get_redirect_xattr() · 92f0d6c9
      Miklos Szeredi 提交于
      This is a partial revert (with some cleanups) of commit 993a0b2a ("ovl:
      Do not lose security.capability xattr over metadata file copy-up"), which
      introduced ovl_getxattr() in the first place.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      92f0d6c9
    • M
      ovl: clean up ovl_getxattr() in copy_up.c · de7a52c9
      Miklos Szeredi 提交于
      Lose the padding and the failure message (in line with other parts of the
      copy up process).  Return zero for both nonexistent or empty xattr.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      de7a52c9
    • M
      duplicate ovl_getxattr() · fee0f298
      Miklos Szeredi 提交于
      ovl_getattr() returns the value of an xattr in a kmalloced buffer.  There
      are two callers:
      
       ovl_copy_up_meta_inode_data()	(copy_up.c)
       ovl_get_redirect_xattr()	(util.c)
      
      This patch just copies ovl_getxattr() to copy_up.c, the following patches
      will deal with the differences in idividual callers.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      fee0f298
    • V
      ovl: provide a mount option "volatile" · c86243b0
      Vivek Goyal 提交于
      Container folks are complaining that dnf/yum issues too many sync while
      installing packages and this slows down the image build. Build requirement
      is such that they don't care if a node goes down while build was still
      going on. In that case, they will simply throw away unfinished layer and
      start new build. So they don't care about syncing intermediate state to the
      disk and hence don't want to pay the price associated with sync.
      
      So they are asking for mount options where they can disable sync on overlay
      mount point.
      
      They primarily seem to have two use cases.
      
      - For building images, they will mount overlay with nosync and then sync
        upper layer after unmounting overlay and reuse upper as lower for next
        layer.
      
      - For running containers, they don't seem to care about syncing upper layer
        because if node goes down, they will simply throw away upper layer and
        create a fresh one.
      
      So this patch provides a mount option "volatile" which disables all forms
      of sync. Now it is caller's responsibility to throw away upper if system
      crashes or shuts down and start fresh.
      
      With "volatile", I am seeing roughly 20% speed up in my VM where I am just
      installing emacs in an image. Installation time drops from 31 seconds to 25
      seconds when nosync option is used. This is for the case of building on top
      of an image where all packages are already cached. That way I take out the
      network operations latency out of the measurement.
      
      Giuseppe is also looking to cut down on number of iops done on the disk. He
      is complaining that often in cloud their VMs are throttled if they cross
      the limit. This option can help them where they reduce number of iops (by
      cutting down on frequent sync and writebacks).
      Signed-off-by: NGiuseppe Scrivano <gscrivan@redhat.com>
      Signed-off-by: NVivek Goyal <vgoyal@redhat.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      c86243b0