syzbot


possible deadlock in ovl_nlink_start

Status: auto-closed as invalid on 2021/04/07 14:02
Reported-by: syzbot+e8adfd1f7b662b7bdb97@syzkaller.appspotmail.com
First crash: 1445d, last: 1445d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 possible deadlock in ovl_nlink_start (2) 1 819d 819d 0/1 auto-obsoleted due to no activity on 2022/12/24 15:21
upstream possible deadlock in ovl_nlink_start overlayfs 2 196d 218d 0/28 closed as dup on 2024/04/19 07:03

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
4.14.211-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.5/13849 is trying to acquire lock:
 (&oi->lock){+.+.}, at: [<ffffffff823617ef>] ovl_nlink_start+0x22f/0x460 fs/overlayfs/util.c:523

but task is already holding lock:
 (sb_writers#3){.+.+}, at: [<ffffffff81901a3a>] sb_start_write include/linux/fs.h:1549 [inline]
 (sb_writers#3){.+.+}, at: [<ffffffff81901a3a>] 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#3){.+.+}:
       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:1549 [inline]
       mnt_want_write+0x3a/0xb0 fs/namespace.c:386
       ovl_do_remove+0x67/0xb90 fs/overlayfs/dir.c:759
       vfs_rmdir.part.0+0x144/0x390 fs/namei.c:3908
       vfs_rmdir fs/namei.c:3893 [inline]
       do_rmdir+0x334/0x3c0 fs/namei.c:3968
       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]){++++}:
       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/0x345 fs/overlayfs/namei.c:783
       ovl_rename+0x47c/0xf10 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_nlink_start+0x22f/0x460 fs/overlayfs/util.c:523
       ovl_do_remove+0xd4/0xb90 fs/overlayfs/dir.c:767
       vfs_unlink+0x230/0x470 fs/namei.c:4027
       do_unlinkat+0x30c/0x5c0 fs/namei.c:4092
       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] --> sb_writers#3

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

4 locks held by syz-executor.5/13849:
 #0:  (sb_writers#16){.+.+}, at: [<ffffffff81901a3a>] sb_start_write include/linux/fs.h:1549 [inline]
 #0:  (sb_writers#16){.+.+}, at: [<ffffffff81901a3a>] mnt_want_write+0x3a/0xb0 fs/namespace.c:386
 #1:  (&ovl_i_mutex_dir_key[depth]/1){+.+.}, at: [<ffffffff818c9d11>] inode_lock_nested include/linux/fs.h:754 [inline]
 #1:  (&ovl_i_mutex_dir_key[depth]/1){+.+.}, at: [<ffffffff818c9d11>] do_unlinkat+0x201/0x5c0 fs/namei.c:4078
 #2:  (&ovl_i_mutex_key[depth]#2){+.+.}, at: [<ffffffff818bb500>] inode_lock include/linux/fs.h:719 [inline]
 #2:  (&ovl_i_mutex_key[depth]#2){+.+.}, at: [<ffffffff818bb500>] vfs_unlink+0xc0/0x470 fs/namei.c:4018
 #3:  (sb_writers#3){.+.+}, at: [<ffffffff81901a3a>] sb_start_write include/linux/fs.h:1549 [inline]
 #3:  (sb_writers#3){.+.+}, at: [<ffffffff81901a3a>] mnt_want_write+0x3a/0xb0 fs/namespace.c:386

stack backtrace:
CPU: 0 PID: 13849 Comm: syz-executor.5 Not tainted 4.14.211-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/0x283 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_nlink_start+0x22f/0x460 fs/overlayfs/util.c:523
 ovl_do_remove+0xd4/0xb90 fs/overlayfs/dir.c:767
 vfs_unlink+0x230/0x470 fs/namei.c:4027
 do_unlinkat+0x30c/0x5c0 fs/namei.c:4092
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x45e0f9
RSP: 002b:00007f9ccbba7c68 EFLAGS: 00000246 ORIG_RAX: 0000000000000057
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 000000000045e0f9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000080
RBP: 000000000119bfb0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000119bf8c
R13: 00007ffe4945217f R14: 00007f9ccbba89c0 R15: 000000000119bf8c
overlayfs: upperdir is in-use by another mount, mount with '-o index=off' to override exclusive upperdir protection.
Cannot find set identified by id 0 to match
Cannot find set identified by id 0 to match
Cannot find set identified by id 0 to match
Cannot find set identified by id 0 to match
FAT-fs (loop1): bread failed, FSINFO block (sector = 1)
blktrace: Concurrent blktraces are not allowed on sg0
FAT-fs (loop1): bread failed, FSINFO block (sector = 1)
blktrace: Concurrent blktraces are not allowed on sg0
FAT-fs (loop1): bread failed, FSINFO block (sector = 1)
blktrace: Concurrent blktraces are not allowed on sg0
FAT-fs (loop1): bread failed, FSINFO block (sector = 1)
PM: Marking nosave pages: [mem 0x00000000-0x00000fff]
PM: Marking nosave pages: [mem 0x0009f000-0x000fffff]
PM: Marking nosave pages: [mem 0xbfffd000-0xffffffff]
PM: Basic memory bitmaps created
PM: Basic memory bitmaps freed
PM: Marking nosave pages: [mem 0x00000000-0x00000fff]
PM: Marking nosave pages: [mem 0x0009f000-0x000fffff]
PM: Marking nosave pages: [mem 0xbfffd000-0xffffffff]
PM: Basic memory bitmaps created
PM: Basic memory bitmaps freed

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/12/08 14:01 linux-4.14.y 47cbf4cc32db 9af51e31 .config console log report info ci2-linux-4-14
* Struck through repros no longer work on HEAD.