syzbot


possible deadlock in seq_read_iter

Status: upstream: reported on 2024/04/28 04:21
Reported-by: syzbot+4b5aa00f98a06734de64@syzkaller.appspotmail.com
First crash: 207d, last: 9d02h
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in seq_read_iter (4) overlayfs 33 17d 178d 0/28 closed as dup on 2024/05/27 09:33
upstream possible deadlock in seq_read_iter (2) overlayfs C done done 14 331d 490d 25/28 fixed on 2024/02/02 10:05
upstream possible deadlock in seq_read_iter fs 2 1202d 1208d 0/28 auto-closed as invalid on 2021/12/05 03:01
upstream possible deadlock in seq_read_iter (3) overlayfs 148 193d 283d 25/28 fixed on 2024/05/23 00:16

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.15.171-syzkaller #0 Not tainted
------------------------------------------------------
syz.1.987/8569 is trying to acquire lock:
ffff888054997790 (&p->lock){+.+.}-{3:3}, at: seq_read_iter+0xae/0xd10 fs/seq_file.c:182

but task is already holding lock:
ffff8880791e8460 (sb_writers#3){.+.+}-{0:0}, at: do_sendfile+0x5fd/0x1000 fs/read_write.c:1248

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #7 (sb_writers#3){.+.+}-{0:0}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1813 [inline]
       sb_start_write include/linux/fs.h:1883 [inline]
       file_start_write include/linux/fs.h:3044 [inline]
       lo_write_bvec+0x1a3/0x740 drivers/block/loop.c:315
       lo_write_simple drivers/block/loop.c:338 [inline]
       do_req_filebacked drivers/block/loop.c:656 [inline]
       loop_handle_cmd drivers/block/loop.c:2234 [inline]
       loop_process_work+0x2309/0x2af0 drivers/block/loop.c:2274
       process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
       worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
       kthread+0x3f6/0x4f0 kernel/kthread.c:334
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

-> #6 ((work_completion)(&worker->work)){+.+.}-{0:0}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       process_one_work+0x7f1/0x10c0 kernel/workqueue.c:2286
       worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
       kthread+0x3f6/0x4f0 kernel/kthread.c:334
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

-> #5 ((null)){+.+.}-{0:0}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       flush_workqueue+0x170/0x1610 kernel/workqueue.c:2830
       drain_workqueue+0xc5/0x390 kernel/workqueue.c:2995
       destroy_workqueue+0x7b/0xae0 kernel/workqueue.c:4439
       __loop_clr_fd+0x241/0xbe0 drivers/block/loop.c:1383
       blkdev_put_whole block/bdev.c:692 [inline]
       blkdev_put+0x455/0x790 block/bdev.c:954
       deactivate_locked_super+0xa0/0x110 fs/super.c:335
       cleanup_mnt+0x44e/0x500 fs/namespace.c:1143
       task_work_run+0x129/0x1a0 kernel/task_work.c:188
       tracehook_notify_resume include/linux/tracehook.h:189 [inline]
       exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:181
       exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214
       __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
       syscall_exit_to_user_mode+0x5d/0x240 kernel/entry/common.c:307
       do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #4 (&lo->lo_mutex){+.+.}-{3:3}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
       __mutex_lock kernel/locking/mutex.c:729 [inline]
       mutex_lock_killable_nested+0x17/0x20 kernel/locking/mutex.c:758
       lo_open+0x68/0x100 drivers/block/loop.c:2055
       blkdev_get_whole+0x94/0x390 block/bdev.c:669
       blkdev_get_by_dev+0x2bc/0xa50 block/bdev.c:824
       blkdev_open+0x138/0x2d0 block/fops.c:463
       do_dentry_open+0x807/0xfb0 fs/open.c:826
       do_open fs/namei.c:3608 [inline]
       path_openat+0x2705/0x2f20 fs/namei.c:3742
       do_filp_open+0x21c/0x460 fs/namei.c:3769
       do_sys_openat2+0x13b/0x4f0 fs/open.c:1253
       do_sys_open fs/open.c:1269 [inline]
       __do_sys_openat fs/open.c:1285 [inline]
       __se_sys_openat fs/open.c:1280 [inline]
       __x64_sys_openat+0x243/0x290 fs/open.c:1280
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #3 (&disk->open_mutex){+.+.}-{3:3}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
       __mutex_lock kernel/locking/mutex.c:729 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
       blkdev_get_by_dev+0x14d/0xa50 block/bdev.c:817
       swsusp_check+0xb1/0x2c0 kernel/power/swap.c:1526
       software_resume+0xc6/0x3c0 kernel/power/hibernate.c:977
       resume_store+0xe3/0x130 kernel/power/hibernate.c:1179
       kernfs_fop_write_iter+0x3a2/0x4f0 fs/kernfs/file.c:296
       call_write_iter include/linux/fs.h:2174 [inline]
       new_sync_write fs/read_write.c:507 [inline]
       vfs_write+0xacd/0xe50 fs/read_write.c:594
       ksys_write+0x1a2/0x2c0 fs/read_write.c:647
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #2 (system_transition_mutex/1){+.+.}-{3:3}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
       __mutex_lock kernel/locking/mutex.c:729 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
       software_resume+0x7c/0x3c0 kernel/power/hibernate.c:932
       resume_store+0xe3/0x130 kernel/power/hibernate.c:1179
       kernfs_fop_write_iter+0x3a2/0x4f0 fs/kernfs/file.c:296
       call_write_iter include/linux/fs.h:2174 [inline]
       new_sync_write fs/read_write.c:507 [inline]
       vfs_write+0xacd/0xe50 fs/read_write.c:594
       ksys_write+0x1a2/0x2c0 fs/read_write.c:647
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #1 (&of->mutex){+.+.}-{3:3}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
       __mutex_lock kernel/locking/mutex.c:729 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
       kernfs_seq_start+0x50/0x3b0 fs/kernfs/file.c:112
       seq_read_iter+0x3d0/0xd10 fs/seq_file.c:225
       call_read_iter include/linux/fs.h:2168 [inline]
       new_sync_read fs/read_write.c:404 [inline]
       vfs_read+0xa93/0xe10 fs/read_write.c:485
       ksys_read+0x1a2/0x2c0 fs/read_write.c:623
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #0 (&p->lock){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3053 [inline]
       check_prevs_add kernel/locking/lockdep.c:3172 [inline]
       validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788
       __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
       __mutex_lock kernel/locking/mutex.c:729 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
       seq_read_iter+0xae/0xd10 fs/seq_file.c:182
       call_read_iter include/linux/fs.h:2168 [inline]
       generic_file_splice_read+0x4ad/0x790 fs/splice.c:311
       do_splice_to fs/splice.c:796 [inline]
       splice_direct_to_actor+0x448/0xc10 fs/splice.c:870
       do_splice_direct+0x285/0x3d0 fs/splice.c:979
       do_sendfile+0x622/0x1000 fs/read_write.c:1249
       __do_sys_sendfile64 fs/read_write.c:1317 [inline]
       __se_sys_sendfile64+0x178/0x1e0 fs/read_write.c:1303
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

other info that might help us debug this:

Chain exists of:
  &p->lock --> (work_completion)(&worker->work) --> sb_writers#3

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(sb_writers#3);
                               lock((work_completion)(&worker->work));
                               lock(sb_writers#3);
  lock(&p->lock);

 *** DEADLOCK ***

1 lock held by syz.1.987/8569:
 #0: ffff8880791e8460 (sb_writers#3){.+.+}-{0:0}, at: do_sendfile+0x5fd/0x1000 fs/read_write.c:1248

stack backtrace:
CPU: 1 PID: 8569 Comm: syz.1.987 Not tainted 5.15.171-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 check_noncircular+0x2f8/0x3b0 kernel/locking/lockdep.c:2133
 check_prev_add kernel/locking/lockdep.c:3053 [inline]
 check_prevs_add kernel/locking/lockdep.c:3172 [inline]
 validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788
 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
 __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
 __mutex_lock kernel/locking/mutex.c:729 [inline]
 mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
 seq_read_iter+0xae/0xd10 fs/seq_file.c:182
 call_read_iter include/linux/fs.h:2168 [inline]
 generic_file_splice_read+0x4ad/0x790 fs/splice.c:311
 do_splice_to fs/splice.c:796 [inline]
 splice_direct_to_actor+0x448/0xc10 fs/splice.c:870
 do_splice_direct+0x285/0x3d0 fs/splice.c:979
 do_sendfile+0x622/0x1000 fs/read_write.c:1249
 __do_sys_sendfile64 fs/read_write.c:1317 [inline]
 __se_sys_sendfile64+0x178/0x1e0 fs/read_write.c:1303
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7fa04e89a719
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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fa04cd12038 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00007fa04ea51f80 RCX: 00007fa04e89a719
RDX: 0000000000000000 RSI: 0000000000000005 RDI: 0000000000000006
RBP: 00007fa04e90d616 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000080000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fa04ea51f80 R15: 00007ffe49cf3a48
 </TASK>

Crashes (28):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/12 09:17 linux-5.15.y 3c17fc483905 75bb1b32 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/11/06 17:55 linux-5.15.y 72244eab0dad df3dc63b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/11/03 22:43 linux-5.15.y 72244eab0dad f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/10/21 13:03 linux-5.15.y 584a40a22cb9 f1e4447c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/10/15 04:48 linux-5.15.y 3a5928702e71 b01b6661 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/10/11 22:56 linux-5.15.y 3a5928702e71 084d8178 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/10/08 17:08 linux-5.15.y 3a5928702e71 402f1df0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/10/05 05:49 linux-5.15.y 3a5928702e71 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/09/26 18:00 linux-5.15.y 3a5928702e71 9314348a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/09/05 17:04 linux-5.15.y 14e468424d3e 464ac2ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/09/01 12:46 linux-5.15.y fa93fa65db6e 1eda0d14 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/09/01 07:36 linux-5.15.y fa93fa65db6e 1eda0d14 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/08/25 10:49 linux-5.15.y fa93fa65db6e d7d32352 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/08/21 13:22 linux-5.15.y fa93fa65db6e db5852f9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/08/06 06:35 linux-5.15.y 7e89efd3ae1c e1bdb00a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/08/05 00:11 linux-5.15.y 7e89efd3ae1c 1786a2a8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/07/30 22:51 linux-5.15.y 7e89efd3ae1c 6fde257d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/07/29 13:44 linux-5.15.y 7e89efd3ae1c 5187fc86 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/07/26 16:41 linux-5.15.y 7c6d66f0266f 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/07/25 14:43 linux-5.15.y 7c6d66f0266f 466a14e5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/07/25 11:02 linux-5.15.y 7c6d66f0266f 466a14e5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/07/13 21:12 linux-5.15.y f45bea23c39c eaeb5c15 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/07/04 09:19 linux-5.15.y 4878aadf2d15 3f2748a3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/07/03 18:46 linux-5.15.y 4878aadf2d15 f76a75f3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/05/09 11:52 linux-5.15.y 284087d4f7d5 05079661 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/05/01 21:24 linux-5.15.y b925f60c6ee7 3ba885bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/04/28 04:20 linux-5.15.y b925f60c6ee7 07b455f9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in seq_read_iter
2024/05/02 01:46 linux-5.15.y b925f60c6ee7 3ba885bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in seq_read_iter
* Struck through repros no longer work on HEAD.