syzbot


possible deadlock in iterate_supers

Status: closed as dup on 2022/03/30 22:17
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+2289e1c10dde387e671e@syzkaller.appspotmail.com
First crash: 969d, last: 942d
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
possible deadlock in p9_write_work v9fs 22 941d 968d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] possible deadlock in iterate_supers 0 (1) 2022/03/30 17:36

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.18.0-rc3-next-20220420-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.4/14111 is trying to acquire lock:
ffff88814be440e0 (&type->s_umount_key#32){++++}-{3:3}, at: iterate_supers+0xdb/0x290 fs/super.c:692

but task is already holding lock:
ffff88807ee48460 (sb_writers#3){.+.+}-{0:0}, at: __do_sys_sendfile64 fs/read_write.c:1305 [inline]
ffff88807ee48460 (sb_writers#3){.+.+}-{0:0}, at: __se_sys_sendfile64 fs/read_write.c:1297 [inline]
ffff88807ee48460 (sb_writers#3){.+.+}-{0:0}, at: __x64_sys_sendfile64+0x149/0x210 fs/read_write.c:1297

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (sb_writers#3){.+.+}-{0:0}:
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1702 [inline]
       sb_start_write include/linux/fs.h:1777 [inline]
       file_start_write include/linux/fs.h:2783 [inline]
       kernel_write fs/read_write.c:564 [inline]
       kernel_write+0x2ac/0x540 fs/read_write.c:555
       p9_fd_write net/9p/trans_fd.c:428 [inline]
       p9_write_work+0x25e/0xca0 net/9p/trans_fd.c:479
       process_one_work+0x996/0x1610 kernel/workqueue.c:2289
       worker_thread+0x665/0x1080 kernel/workqueue.c:2436
       kthread+0x2e9/0x3a0 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

-> #2 ((work_completion)(&m->wq)){+.+.}-{0:0}:
       process_one_work+0x905/0x1610 kernel/workqueue.c:2265
       worker_thread+0x665/0x1080 kernel/workqueue.c:2436
       kthread+0x2e9/0x3a0 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

-> #1 ((wq_completion)events){+.+.}-{0:0}:
       flush_workqueue+0x164/0x1440 kernel/workqueue.c:2831
       flush_scheduled_work include/linux/workqueue.h:583 [inline]
       ext4_put_super+0x99/0x1150 fs/ext4/super.c:1202
       generic_shutdown_super+0x14c/0x400 fs/super.c:462
       kill_block_super+0x97/0xf0 fs/super.c:1394
       deactivate_locked_super+0x94/0x160 fs/super.c:332
       deactivate_super+0xad/0xd0 fs/super.c:363
       cleanup_mnt+0x3a2/0x540 fs/namespace.c:1186
       task_work_run+0xdd/0x1a0 kernel/task_work.c:164
       resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
       exit_to_user_mode_loop kernel/entry/common.c:169 [inline]
       exit_to_user_mode_prepare+0x23c/0x250 kernel/entry/common.c:201
       __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline]
       syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294
       do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
       entry_SYSCALL_64_after_hwframe+0x44/0xae

-> #0 (&type->s_umount_key#32){++++}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3095 [inline]
       check_prevs_add kernel/locking/lockdep.c:3214 [inline]
       validate_chain kernel/locking/lockdep.c:3829 [inline]
       __lock_acquire+0x2abe/0x5660 kernel/locking/lockdep.c:5053
       lock_acquire kernel/locking/lockdep.c:5665 [inline]
       lock_acquire+0x1ab/0x570 kernel/locking/lockdep.c:5630
       down_read+0x98/0x440 kernel/locking/rwsem.c:1489
       iterate_supers+0xdb/0x290 fs/super.c:692
       drop_caches_sysctl_handler+0xdb/0x110 fs/drop_caches.c:62
       proc_sys_call_handler+0x4a1/0x6e0 fs/proc/proc_sysctl.c:604
       call_write_iter include/linux/fs.h:2059 [inline]
       do_iter_readv_writev+0x3d1/0x640 fs/read_write.c:726
       do_iter_write+0x182/0x700 fs/read_write.c:852
       vfs_iter_write+0x70/0xa0 fs/read_write.c:893
       iter_file_splice_write+0x723/0xc70 fs/splice.c:689
       do_splice_from fs/splice.c:767 [inline]
       direct_splice_actor+0x110/0x180 fs/splice.c:936
       splice_direct_to_actor+0x34b/0x8c0 fs/splice.c:891
       do_splice_direct+0x1a7/0x270 fs/splice.c:979
       do_sendfile+0xae0/0x1240 fs/read_write.c:1246
       __do_sys_sendfile64 fs/read_write.c:1305 [inline]
       __se_sys_sendfile64 fs/read_write.c:1297 [inline]
       __x64_sys_sendfile64+0x149/0x210 fs/read_write.c:1297
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae

other info that might help us debug this:

Chain exists of:
  &type->s_umount_key#32 --> (work_completion)(&m->wq) --> sb_writers#3

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(sb_writers#3);
                               lock((work_completion)(&m->wq));
                               lock(sb_writers#3);
  lock(&type->s_umount_key#32);

 *** DEADLOCK ***

1 lock held by syz-executor.4/14111:
 #0: ffff88807ee48460 (sb_writers#3){.+.+}-{0:0}, at: __do_sys_sendfile64 fs/read_write.c:1305 [inline]
 #0: ffff88807ee48460 (sb_writers#3){.+.+}-{0:0}, at: __se_sys_sendfile64 fs/read_write.c:1297 [inline]
 #0: ffff88807ee48460 (sb_writers#3){.+.+}-{0:0}, at: __x64_sys_sendfile64+0x149/0x210 fs/read_write.c:1297

stack backtrace:
CPU: 0 PID: 14111 Comm: syz-executor.4 Not tainted 5.18.0-rc3-next-20220420-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2175
 check_prev_add kernel/locking/lockdep.c:3095 [inline]
 check_prevs_add kernel/locking/lockdep.c:3214 [inline]
 validate_chain kernel/locking/lockdep.c:3829 [inline]
 __lock_acquire+0x2abe/0x5660 kernel/locking/lockdep.c:5053
 lock_acquire kernel/locking/lockdep.c:5665 [inline]
 lock_acquire+0x1ab/0x570 kernel/locking/lockdep.c:5630
 down_read+0x98/0x440 kernel/locking/rwsem.c:1489
 iterate_supers+0xdb/0x290 fs/super.c:692
 drop_caches_sysctl_handler+0xdb/0x110 fs/drop_caches.c:62
 proc_sys_call_handler+0x4a1/0x6e0 fs/proc/proc_sysctl.c:604
 call_write_iter include/linux/fs.h:2059 [inline]
 do_iter_readv_writev+0x3d1/0x640 fs/read_write.c:726
 do_iter_write+0x182/0x700 fs/read_write.c:852
 vfs_iter_write+0x70/0xa0 fs/read_write.c:893
 iter_file_splice_write+0x723/0xc70 fs/splice.c:689
 do_splice_from fs/splice.c:767 [inline]
 direct_splice_actor+0x110/0x180 fs/splice.c:936
 splice_direct_to_actor+0x34b/0x8c0 fs/splice.c:891
 do_splice_direct+0x1a7/0x270 fs/splice.c:979
 do_sendfile+0xae0/0x1240 fs/read_write.c:1246
 __do_sys_sendfile64 fs/read_write.c:1305 [inline]
 __se_sys_sendfile64 fs/read_write.c:1297 [inline]
 __x64_sys_sendfile64+0x149/0x210 fs/read_write.c:1297
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f8f424890e9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f8f436d5168 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00007f8f4259bf60 RCX: 00007f8f424890e9
RDX: 0000000020002080 RSI: 0000000000000003 RDI: 0000000000000004
RBP: 00007f8f424e308d R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000262 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffcca6e34ff R14: 00007f8f436d5300 R15: 0000000000022000
 </TASK>
syz-executor.4 (14111): drop_caches: 1

Crashes (42):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/04/24 14:59 linux-next f1244c81da13 131df97d .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/21 17:15 linux-next f1244c81da13 2738b391 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/20 14:02 linux-next f1244c81da13 160a3f31 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/20 10:49 linux-next f1244c81da13 7d7bc738 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/19 23:54 linux-next 634de1db0e9b 7d7bc738 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/19 13:10 linux-next 634de1db0e9b c334415e .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/19 11:36 linux-next 634de1db0e9b c334415e .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/19 11:06 linux-next 634de1db0e9b c334415e .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/19 10:11 linux-next 634de1db0e9b 8bcc32a6 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/16 10:34 linux-next 40354149f4d7 8bcc32a6 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/13 08:11 linux-next c97e430ab553 faabdb86 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/13 08:07 linux-next c97e430ab553 faabdb86 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/13 07:35 linux-next c97e430ab553 faabdb86 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/13 07:25 linux-next c97e430ab553 faabdb86 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/12 09:57 linux-next d0c745e7b2d6 af01ee7d .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/12 04:27 linux-next d12d7e1cfe38 af01ee7d .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/11 20:42 linux-next d12d7e1cfe38 af01ee7d .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/11 13:29 linux-next d12d7e1cfe38 af01ee7d .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/11 06:16 linux-next d12d7e1cfe38 e22c3da3 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/09 11:16 linux-next ff511c1c68a5 e22c3da3 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/09 03:17 linux-next ff511c1c68a5 e22c3da3 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/06 19:53 linux-next 109f6d10ec17 97582466 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/06 19:42 linux-next 109f6d10ec17 97582466 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/06 18:50 linux-next 109f6d10ec17 97582466 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/06 11:24 linux-next 109f6d10ec17 86b4b7f8 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/05 17:06 linux-next 3ccc91681259 0127c10f .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/05 15:59 linux-next 3ccc91681259 0127c10f .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/04 15:45 linux-next 696206280c5e 5915c2cb .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/04 05:07 linux-next 696206280c5e 79a2a8fc .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/03 01:49 linux-next e5071887cd22 79a2a8fc .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/01 13:16 linux-next e5071887cd22 20955a24 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/04/01 01:24 linux-next fdcbcd1348f4 68fc921a .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/03/31 14:42 linux-next fdcbcd1348f4 c4c32d8c .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/03/31 14:11 linux-next fdcbcd1348f4 c4c32d8c .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/03/30 12:43 linux-next a67ba3cf9551 42718dd6 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/03/30 05:23 linux-next a67ba3cf9551 6bdac766 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/03/30 05:12 linux-next a67ba3cf9551 6bdac766 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/03/28 13:24 linux-next 8515d05bf6bc ee339263 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/03/28 12:33 linux-next 8515d05bf6bc ee339263 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/03/28 12:24 linux-next 8515d05bf6bc ee339263 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/03/28 11:54 linux-next 8515d05bf6bc ee339263 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
2022/03/28 05:32 linux-next 8515d05bf6bc 89bc8608 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in iterate_supers
* Struck through repros no longer work on HEAD.