syzbot


possible deadlock in path_openat

Status: upstream: reported C repro on 2019/04/24 01:40
Reported-by: syzbot+8072af70f10c9b17946f@syzkaller.appspotmail.com
First crash: 1377d, last: 115d

Fix bisection: failed (bisect log)
similar bugs (4):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in path_openat C done unreliable 349 1032d 1587d 0/24 auto-obsoleted due to no activity on 2022/09/16 21:43
android-49 possible deadlock in path_openat 5 1162d 1177d 0/3 auto-closed as invalid on 2020/03/24 08:43
upstream possible deadlock in path_openat (2) reiserfs C error 31 12d 111d 0/24 upstream: reported C repro on 2022/10/11 06:35
linux-4.19 possible deadlock in path_openat C 857 9h35m 1325d 0/1 upstream: reported C repro on 2019/06/15 07:08

Sample crash report:
REISERFS (device loop0): journal params: device loop0, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop0): checking transaction log (loop0)
REISERFS (device loop0): Using rupasov hash to sort names
REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage.
======================================================
WARNING: possible circular locking dependency detected
4.14.295-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor423/8000 is trying to acquire lock:
 (&type->i_mutex_dir_key#7){+.+.}, at: [<ffffffff818a3232>] inode_lock include/linux/fs.h:719 [inline]
 (&type->i_mutex_dir_key#7){+.+.}, at: [<ffffffff818a3232>] do_last fs/namei.c:3331 [inline]
 (&type->i_mutex_dir_key#7){+.+.}, at: [<ffffffff818a3232>] path_openat+0xde2/0x2970 fs/namei.c:3571

but task is already holding lock:
 (sb_writers#10){.+.+}, at: [<ffffffff818e083a>] sb_start_write include/linux/fs.h:1551 [inline]
 (sb_writers#10){.+.+}, at: [<ffffffff818e083a>] 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#10){.+.+}:
       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_file+0xfd/0x3b0 fs/namespace.c:497
       reiserfs_ioctl+0x18e/0x8b0 fs/reiserfs/ioctl.c:110
       vfs_ioctl fs/ioctl.c:46 [inline]
       file_ioctl fs/ioctl.c:500 [inline]
       do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684
       SYSC_ioctl fs/ioctl.c:701 [inline]
       SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x46/0xbb

-> #1 (&sbi->lock){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       reiserfs_write_lock+0x75/0xf0 fs/reiserfs/lock.c:27
       reiserfs_lookup+0x130/0x400 fs/reiserfs/namei.c:363
       lookup_real fs/namei.c:1555 [inline]
       __lookup_hash fs/namei.c:1575 [inline]
       __lookup_hash+0x1bb/0x270 fs/namei.c:1563
       lookup_one_len+0x279/0x3a0 fs/namei.c:2539
       reiserfs_lookup_privroot+0x92/0x270 fs/reiserfs/xattr.c:970
       reiserfs_fill_super+0x1d12/0x2990 fs/reiserfs/super.c:2187
       mount_bdev+0x2b3/0x360 fs/super.c:1134
       mount_fs+0x92/0x2a0 fs/super.c:1237
       vfs_kern_mount.part.0+0x5b/0x470 fs/namespace.c:1046
       vfs_kern_mount fs/namespace.c:1036 [inline]
       do_new_mount fs/namespace.c:2572 [inline]
       do_mount+0xe65/0x2a30 fs/namespace.c:2905
       SYSC_mount fs/namespace.c:3121 [inline]
       SyS_mount+0xa8/0x120 fs/namespace.c:3098
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x46/0xbb

-> #0 (&type->i_mutex_dir_key#7){+.+.}:
       lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
       down_write+0x34/0x90 kernel/locking/rwsem.c:54
       inode_lock include/linux/fs.h:719 [inline]
       do_last fs/namei.c:3331 [inline]
       path_openat+0xde2/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

other info that might help us debug this:

Chain exists of:
  &type->i_mutex_dir_key#7 --> &sbi->lock --> sb_writers#10

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(sb_writers#10);
                               lock(&sbi->lock);
                               lock(sb_writers#10);
  lock(&type->i_mutex_dir_key#7);

 *** DEADLOCK ***

1 lock held by syz-executor423/8000:
 #0:  (sb_writers#10){.+.+}, at: [<ffffffff818e083a>] sb_start_write include/linux/fs.h:1551 [inline]
 #0:  (sb_writers#10){.+.+}, at: [<ffffffff818e083a>] mnt_want_write+0x3a/0xb0 fs/namespace.c:386

stack backtrace:
CPU: 1 PID: 8000 Comm: syz-executor423 Not tainted 4.14.295-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/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
 down_write+0x34/0x90 kernel/locking/rwsem.c:54
 inode_lock include/linux/fs.h:719 [inline]
 do_last fs/namei.c:3331 [inline]
 path_openat+0xde2/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
RIP: 0033:0x7fd0ffac98a9
RSP: 002b:00007fffa96f4148 EFLAGS: 00000246 ORIG_RAX: 0000000000000055
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fd0ffac98a9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000040
RBP: 0000000000000000 R08: 00007fd0ffb37ec0 R09: 00007fd0ffb37ec0
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fffa96f4170
R13: 0000000000000000 R14: 431bde82d7b634db R15: 0000000000000000

Crashes (324):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci2-linux-4-14 2022/10/07 08:15 linux-4.14.y 9d5c0b3a8e1a 80b58a42 .config console log report syz C [disk image] [vmlinux] [mounted in repro] possible deadlock in path_openat
ci2-linux-4-14 2019/04/24 00:40 linux-4.14.y 68d7a45eec10 2398edea .config console log report syz C
ci2-linux-4-14 2022/03/12 12:36 linux-4.14.y af48f51cb593 9e8eaa75 .config console log report syz possible deadlock in path_openat
ci2-linux-4-14 2022/01/16 10:21 linux-4.14.y 4ba8e26127c3 723cfaf0 .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/12/06 03:37 linux-4.14.y 66722c42ec91 a617004c .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/12/05 04:19 linux-4.14.y 66722c42ec91 a617004c .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/12/03 22:44 linux-4.14.y 66722c42ec91 c7c20675 .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/05/19 00:44 linux-4.14.y 7d7d1c0ab3eb a343ba6b .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/05/11 23:20 linux-4.14.y 7d7d1c0ab3eb b3c3bb8e .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/05/08 16:06 linux-4.14.y 7d7d1c0ab3eb bc5434be .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/05/04 20:23 linux-4.14.y 7d7d1c0ab3eb 06c27ff5 .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/04/30 17:36 linux-4.14.y 7d7d1c0ab3eb 77e2b668 .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/04/16 15:14 linux-4.14.y cf256fbcbe34 7e2b734b .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/04/15 17:17 linux-4.14.y 958e517f4e16 c59079a6 .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/04/14 12:08 linux-4.14.y 958e517f4e16 3134b37f .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/04/13 11:25 linux-4.14.y 958e517f4e16 6a81331a .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/04/13 08:17 linux-4.14.y 958e517f4e16 6a81331a .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/04/12 11:36 linux-4.14.y 958e517f4e16 6a81331a .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/04/09 05:33 linux-4.14.y 0cc244011f40 6a81331a .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/04/08 19:45 linux-4.14.y 0cc244011f40 6a81331a .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/04/07 23:48 linux-4.14.y 0cc244011f40 6a81331a .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/04/07 07:13 linux-4.14.y bd634aa64163 6a81331a .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/04/07 05:07 linux-4.14.y bd634aa64163 6a81331a .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/04/06 14:08 linux-4.14.y bd634aa64163 6a81331a .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/04/05 09:40 linux-4.14.y bd634aa64163 6a81331a .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/04/05 02:57 linux-4.14.y bd634aa64163 6a81331a .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/04/03 09:49 linux-4.14.y bd634aa64163 6a81331a .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/04/02 19:43 linux-4.14.y bd634aa64163 6a81331a .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/04/02 18:34 linux-4.14.y bd634aa64163 6a81331a .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/04/01 14:19 linux-4.14.y bd634aa64163 6a81331a .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/03/30 20:08 linux-4.14.y bd634aa64163 6a81331a .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/03/28 05:08 linux-4.14.y 670d6552eda8 a8529b82 .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/03/26 09:17 linux-4.14.y 670d6552eda8 6a383ecf .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/03/25 07:39 linux-4.14.y 670d6552eda8 607e3baf .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/03/22 22:21 linux-4.14.y cb83ddcd5332 8092f30d .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/03/22 13:33 linux-4.14.y cb83ddcd5332 bea32f74 .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/03/21 12:41 linux-4.14.y cb83ddcd5332 17810eae .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/03/12 15:02 linux-4.14.y c7150cd2fa8c 429d8a6b .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/03/10 10:56 linux-4.14.y 1d177c0872ab 26967e35 .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/02/27 04:27 linux-4.14.y 3242aa3a635c 4c37c133 .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/02/22 14:55 linux-4.14.y 29c52025152b c26fb06b .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/02/21 10:01 linux-4.14.y 29c52025152b 3e5ed8b4 .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/02/17 08:08 linux-4.14.y 2c8a3fceddf0 052f8d9f .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/02/04 07:47 linux-4.14.y 2c8a3fceddf0 624dad51 .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/02/04 00:04 linux-4.14.y 2c8a3fceddf0 624dad51 .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/02/01 12:19 linux-4.14.y 2c8a3fceddf0 fc9fd31e .config console log report info possible deadlock in path_openat
ci2-linux-4-14 2021/01/09 08:23 linux-4.14.y 1752938529c6 c104d4a3 .config console log report info
* Struck through repros no longer work on HEAD.