syzbot


possible deadlock in ovl_nlink_start (2)

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

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

but task is already holding lock:
 (sb_writers#6){.+.+}, at: [<ffffffff818e03ea>] sb_start_write include/linux/fs.h:1551 [inline]
 (sb_writers#6){.+.+}, at: [<ffffffff818e03ea>] 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#6){.+.+}:
       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_create_object+0x75/0x1d0 fs/overlayfs/dir.c:538
       lookup_open+0x77a/0x1750 fs/namei.c:3241
       do_last fs/namei.c:3334 [inline]
       path_openat+0xe08/0x2970 fs/namei.c:3571
       do_filp_open+0x179/0x3c0 fs/namei.c:3605
       do_sys_open+0x296/0x410 fs/open.c:1081
       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:4498
       SYSC_renameat2 fs/namei.c:4646 [inline]
       SyS_renameat2+0x95b/0xad0 fs/namei.c:4535
       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_link+0xee/0x190 fs/overlayfs/dir.c:607
       vfs_link+0x6d5/0xb40 fs/namei.c:4266
       SYSC_linkat fs/namei.c:4334 [inline]
       SyS_linkat+0x3e5/0x6a0 fs/namei.c:4290
       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#6

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

4 locks held by syz-executor.4/11994:
 #0:  (sb_writers#14){.+.+}, at: [<ffffffff818e03ea>] sb_start_write include/linux/fs.h:1551 [inline]
 #0:  (sb_writers#14){.+.+}, at: [<ffffffff818e03ea>] mnt_want_write+0x3a/0xb0 fs/namespace.c:386
 #1:  (&ovl_i_mutex_dir_key[depth]#2/1){+.+.}, at: [<ffffffff818a7caa>] inode_lock_nested include/linux/fs.h:754 [inline]
 #1:  (&ovl_i_mutex_dir_key[depth]#2/1){+.+.}, at: [<ffffffff818a7caa>] filename_create+0x12a/0x3f0 fs/namei.c:3676
 #2:  (&ovl_i_mutex_key[depth]#2){+.+.}, at: [<ffffffff8189a663>] inode_lock include/linux/fs.h:719 [inline]
 #2:  (&ovl_i_mutex_key[depth]#2){+.+.}, at: [<ffffffff8189a663>] vfs_link+0x553/0xb40 fs/namei.c:4257
 #3:  (sb_writers#6){.+.+}, at: [<ffffffff818e03ea>] sb_start_write include/linux/fs.h:1551 [inline]
 #3:  (sb_writers#6){.+.+}, at: [<ffffffff818e03ea>] mnt_want_write+0x3a/0xb0 fs/namespace.c:386

stack backtrace:
CPU: 1 PID: 11994 Comm: syz-executor.4 Not tainted 4.14.291-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022
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_nlink_start+0x22f/0x460 fs/overlayfs/util.c:523
 ovl_link+0xee/0x190 fs/overlayfs/dir.c:607
 vfs_link+0x6d5/0xb40 fs/namei.c:4266
 SYSC_linkat fs/namei.c:4334 [inline]
 SyS_linkat+0x3e5/0x6a0 fs/namei.c:4290
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x7f59f5524279
RSP: 002b:00007f59f3e99168 EFLAGS: 00000246 ORIG_RAX: 0000000000000056
RAX: ffffffffffffffda RBX: 00007f59f5636f80 RCX: 00007f59f5524279
RDX: 0000000000000000 RSI: 0000000020000280 RDI: 0000000020000200
RBP: 00007f59f557e189 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffd9699fe7f R14: 00007f59f3e99300 R15: 0000000000022000
EXT4-fs (loop1): inodes count not valid: 7077920 vs 32
unregister_netdevice: waiting for ip6gre0 to become free. Usage count = -1
9pnet: Insufficient options for proto=fd
F2FS-fs (loop4): Invalid log sectors per block(393219) log sectorsize(9)
F2FS-fs (loop4): Can't find valid F2FS filesystem in 1th superblock
F2FS-fs (loop4): invalid crc value
F2FS-fs (loop4): Mounted with checkpoint version = 7ad43cd7
F2FS-fs (loop4): Invalid log sectors per block(393219) log sectorsize(9)
F2FS-fs (loop4): Can't find valid F2FS filesystem in 1th superblock
F2FS-fs (loop4): invalid crc value
F2FS-fs (loop4): Mounted with checkpoint version = 7ad43cd7
F2FS-fs (loop4): Invalid log sectors per block(393219) log sectorsize(9)
F2FS-fs (loop4): Can't find valid F2FS filesystem in 1th superblock
mmap: syz-executor.0 (12390) uses deprecated remap_file_pages() syscall. See Documentation/vm/remap_file_pages.txt.

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/08/26 15:20 linux-4.14.y e548869f356f e5a303f1 .config console log report info ci2-linux-4-14 possible deadlock in ovl_nlink_start
* Struck through repros no longer work on HEAD.