syzbot


possible deadlock in ovl_copy_up_start (2)

Status: auto-closed as invalid on 2022/05/17 06:42
Reported-by: syzbot+5a4ef18b82fe4c06dd72@syzkaller.appspotmail.com
First crash: 211d, last: 160d
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 possible deadlock in ovl_copy_up_start 9 421d 629d 0/1 auto-closed as invalid on 2021/08/29 09:58
upstream possible deadlock in ovl_copy_up_start 2 1340d 1348d 12/22 fixed on 2018/11/12 21:25

Sample crash report:
overlayfs: unrecognized mount option "loerdir=.:file0" or missing value
overlayfs: upper fs does not support tmpfile.
overlayfs: upper fs does not support xattr.
overlayfs: upper fs does not support file handles, falling back to index=off.
======================================================
WARNING: possible circular locking dependency detected
4.14.262-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.1/22993 is trying to acquire lock:
 (&oi->lock){+.+.}, at: [<ffffffff823106a0>] ovl_copy_up_start+0x40/0xe0 fs/overlayfs/util.c:318

but task is already holding lock:
 (sb_writers#21){.+.+}, at: [<ffffffff818de91a>] sb_start_write include/linux/fs.h:1551 [inline]
 (sb_writers#21){.+.+}, at: [<ffffffff818de91a>] mnt_want_write+0x3a/0xb0 fs/namespace.c:386

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (sb_writers#21){.+.+}:
       percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:36 [inline]
       percpu_down_read include/linux/percpu-rwsem.h:59 [inline]
       __sb_start_write+0x64/0x260 fs/super.c:1342
       sb_start_write include/linux/fs.h:1551 [inline]
       mnt_want_write+0x3a/0xb0 fs/namespace.c:386
       ovl_setattr+0x52/0x500 fs/overlayfs/inode.c:38
       notify_change+0x56b/0xd10 fs/attr.c:313
       chown_common+0x40b/0x4b0 fs/open.c:631
       SYSC_fchownat fs/open.c:661 [inline]
       SyS_fchownat+0xf6/0x190 fs/open.c:641
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x46/0xbb

-> #1 (&ovl_i_mutex_dir_key[depth]#2){++++}:
       down_read+0x36/0x80 kernel/locking/rwsem.c:24
       inode_lock_shared include/linux/fs.h:729 [inline]
       lookup_slow+0x129/0x400 fs/namei.c:1674
       lookup_one_len_unlocked+0x3a0/0x410 fs/namei.c:2595
       ovl_lower_positive+0x184/0x350 fs/overlayfs/namei.c:783
       ovl_rename+0x47c/0xe50 fs/overlayfs/dir.c:968
       vfs_rename+0x560/0x1820 fs/namei.c:4496
       SYSC_renameat2 fs/namei.c:4644 [inline]
       SyS_renameat2+0x95b/0xad0 fs/namei.c:4533
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x46/0xbb

-> #0 (&oi->lock){+.+.}:
       lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       ovl_copy_up_start+0x40/0xe0 fs/overlayfs/util.c:318
       ovl_copy_up_one+0x21f/0x910 fs/overlayfs/copy_up.c:631
       ovl_copy_up_flags+0xd5/0x120 fs/overlayfs/copy_up.c:686
       ovl_xattr_set+0x18c/0x290 fs/overlayfs/inode.c:227
       __vfs_setxattr+0xdc/0x130 fs/xattr.c:150
       __vfs_setxattr_noperm+0xfd/0x3d0 fs/xattr.c:181
       __vfs_setxattr_locked+0x14d/0x250 fs/xattr.c:239
       vfs_setxattr+0xcf/0x230 fs/xattr.c:256
       setxattr+0x1a9/0x300 fs/xattr.c:523
       path_setxattr+0x118/0x130 fs/xattr.c:542
       SYSC_lsetxattr fs/xattr.c:564 [inline]
       SyS_lsetxattr+0x33/0x40 fs/xattr.c:560
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x46/0xbb

other info that might help us debug this:

Chain exists of:
  &oi->lock --> &ovl_i_mutex_dir_key[depth]#2 --> sb_writers#21

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(sb_writers#21);
                               lock(&ovl_i_mutex_dir_key[depth]#2);
                               lock(sb_writers#21);
  lock(&oi->lock);

 *** DEADLOCK ***

3 locks held by syz-executor.1/22993:
 #0:  (sb_writers#13){.+.+}, at: [<ffffffff818de91a>] sb_start_write include/linux/fs.h:1551 [inline]
 #0:  (sb_writers#13){.+.+}, at: [<ffffffff818de91a>] mnt_want_write+0x3a/0xb0 fs/namespace.c:386
 #1:  (&ovl_i_mutex_dir_key[depth]#2){++++}, at: [<ffffffff818f1c41>] inode_lock include/linux/fs.h:719 [inline]
 #1:  (&ovl_i_mutex_dir_key[depth]#2){++++}, at: [<ffffffff818f1c41>] vfs_setxattr+0xb1/0x230 fs/xattr.c:255
 #2:  (sb_writers#21){.+.+}, at: [<ffffffff818de91a>] sb_start_write include/linux/fs.h:1551 [inline]
 #2:  (sb_writers#21){.+.+}, at: [<ffffffff818de91a>] mnt_want_write+0x3a/0xb0 fs/namespace.c:386

stack backtrace:
CPU: 0 PID: 22993 Comm: syz-executor.1 Not tainted 4.14.262-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1258
 check_prev_add kernel/locking/lockdep.c:1905 [inline]
 check_prevs_add kernel/locking/lockdep.c:2022 [inline]
 validate_chain kernel/locking/lockdep.c:2464 [inline]
 __lock_acquire+0x2e0e/0x3f20 kernel/locking/lockdep.c:3491
 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
 __mutex_lock_common kernel/locking/mutex.c:756 [inline]
 __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
 ovl_copy_up_start+0x40/0xe0 fs/overlayfs/util.c:318
 ovl_copy_up_one+0x21f/0x910 fs/overlayfs/copy_up.c:631
 ovl_copy_up_flags+0xd5/0x120 fs/overlayfs/copy_up.c:686
 ovl_xattr_set+0x18c/0x290 fs/overlayfs/inode.c:227
 __vfs_setxattr+0xdc/0x130 fs/xattr.c:150
 __vfs_setxattr_noperm+0xfd/0x3d0 fs/xattr.c:181
 __vfs_setxattr_locked+0x14d/0x250 fs/xattr.c:239
 vfs_setxattr+0xcf/0x230 fs/xattr.c:256
 setxattr+0x1a9/0x300 fs/xattr.c:523
 path_setxattr+0x118/0x130 fs/xattr.c:542
 SYSC_lsetxattr fs/xattr.c:564 [inline]
 SyS_lsetxattr+0x33/0x40 fs/xattr.c:560
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x7f51e7359fe9
RSP: 002b:00007f51e5ccf168 EFLAGS: 00000246 ORIG_RAX: 00000000000000bd
RAX: ffffffffffffffda RBX: 00007f51e746cf60 RCX: 00007f51e7359fe9
RDX: 0000000000000000 RSI: 0000000020000180 RDI: 0000000020000000
RBP: 00007f51e73b408d R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffd4179ff5f R14: 00007f51e5ccf300 R15: 0000000000022000
audit: type=1804 audit(1642401691.534:307): pid=23000 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.0" name="/root/syzkaller-testdir191344604/syzkaller.5F6iGN/263/bus" dev="sda1" ino=14393 res=1
audit: type=1800 audit(1642401691.534:308): pid=23000 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.0" name="bus" dev="sda1" ino=14393 res=0
overlayfs: unrecognized mount option "loerdir=.:file0" or missing value
overlayfs: upper fs does not support tmpfile.
overlayfs: upper fs does not support xattr.
overlayfs: upper fs does not support file handles, falling back to index=off.
audit: type=1804 audit(1642401691.824:309): pid=23026 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.0" name="/root/syzkaller-testdir191344604/syzkaller.5F6iGN/264/bus" dev="sda1" ino=14393 res=1
audit: type=1800 audit(1642401691.824:310): pid=23026 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.0" name="bus" dev="sda1" ino=14393 res=0
overlayfs: unrecognized mount option "loerdir=.:file0" or missing value
overlayfs: unrecognized mount option "loerdir=.:file0" or missing value
overlayfs: upper fs does not support tmpfile.
audit: type=1804 audit(1642401692.194:311): pid=23102 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir690515951/syzkaller.xJniK8/268/bus" dev="sda1" ino=14875 res=1
overlayfs: upper fs does not support xattr.
overlayfs: unrecognized mount option "loerdir=.:file0" or missing value
overlayfs: upper fs does not support file handles, falling back to index=off.
overlayfs: upper fs does not support tmpfile.
audit: type=1800 audit(1642401692.194:312): pid=23102 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.4" name="bus" dev="sda1" ino=14875 res=0
overlayfs: upper fs does not support xattr.
overlayfs: upper fs does not support file handles, falling back to index=off.
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.3'.
(unnamed net_device) (uninitialized): HSR: No slave devices specified
audit: type=1804 audit(1642401692.745:313): pid=23144 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.0" name="/root/syzkaller-testdir191344604/syzkaller.5F6iGN/265/bus" dev="sda1" ino=14793 res=1
EXT4-fs (sda1): Unrecognized mount option "huge=never" or missing value
audit: type=1800 audit(1642401692.745:314): pid=23144 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.0" name="bus" dev="sda1" ino=14793 res=0
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.3'.
(unnamed net_device) (uninitialized): HSR: No slave devices specified
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.3'.
overlayfs: fs on 'file0' does not support file handles, falling back to index=off.
(unnamed net_device) (uninitialized): HSR: No slave devices specified
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.3'.
(unnamed net_device) (uninitialized): HSR: No slave devices specified
overlayfs: fs on './file0' does not support file handles, falling back to index=off.
overlayfs: invalid redirect (./file0)
audit: type=1804 audit(1642401693.545:315): pid=23210 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.3" name="/root/syzkaller-testdir280207349/syzkaller.9nAVnX/225/file0" dev="sda1" ino=14338 res=1
overlayfs: fs on 'file0' does not support file handles, falling back to index=off.
audit: type=1800 audit(1642401693.575:316): pid=23210 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.3" name="file0" dev="sda1" ino=14338 res=0
overlayfs: fs on 'file0' does not support file handles, falling back to index=off.
overlayfs: fs on './file0' does not support file handles, falling back to index=off.
ieee80211 phy2: Selected rate control algorithm 'minstrel_ht'
ieee80211 phy2: hwaddr 02:00:00:00:02:00 registered
ieee80211 phy3: Selected rate control algorithm 'minstrel_ht'
ieee80211 phy3: hwaddr 02:00:00:00:03:00 registered
ieee80211 phy4: Selected rate control algorithm 'minstrel_ht'
ieee80211 phy4: hwaddr 02:00:00:00:04:00 registered
ieee80211 phy5: Selected rate control algorithm 'minstrel_ht'
ieee80211 phy5: hwaddr 02:00:00:00:05:00 registered
EXT4-fs (loop4): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs (loop4): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs (loop4): mounted filesystem without journal. Opts: ,errors=continue
print_req_error: I/O error, dev loop5, sector 0

Crashes (6):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2022/01/17 06:41 linux-4.14.y 4ba8e26127c3 723cfaf0 .config log report info possible deadlock in ovl_copy_up_start
ci2-linux-4-14 2022/01/11 09:15 linux-4.14.y bfdef05c8da4 1884f55a .config log report info possible deadlock in ovl_copy_up_start
ci2-linux-4-14 2021/12/16 14:43 linux-4.14.y 9dfbac0e6b86 8dd6a5e3 .config log report info possible deadlock in ovl_copy_up_start
ci2-linux-4-14 2021/12/06 05:09 linux-4.14.y 66722c42ec91 a617004c .config log report info possible deadlock in ovl_copy_up_start
ci2-linux-4-14 2021/12/05 21:35 linux-4.14.y 66722c42ec91 a617004c .config log report info possible deadlock in ovl_copy_up_start
ci2-linux-4-14 2021/11/28 05:43 linux-4.14.y 66722c42ec91 63eeac02 .config log report info possible deadlock in ovl_copy_up_start