syzbot


possible deadlock in kernfs_fop_write_iter

Status: upstream: reported on 2025/08/27 21:08
Reported-by: syzbot+91b0074eab4a94ac90ae@syzkaller.appspotmail.com
First crash: 3d22h, last: 3d22h
Similar bugs (4)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in kernfs_fop_write_iter kernfs 4 14 400d 425d 0/29 auto-obsoleted due to no activity on 2024/10/05 00:05
linux-5.15 possible deadlock in kernfs_fop_write_iter 4 3 205d 302d 0/3 auto-obsoleted due to no activity on 2025/05/17 20:05
upstream possible deadlock in kernfs_fop_write_iter (2) kernfs 4 72 1d05h 321d 0/29 upstream: reported on 2024/10/14 06:57
linux-5.15 possible deadlock in kernfs_fop_write_iter (2) 4 1 91d 91d 0/3 upstream: reported on 2025/06/01 09:33

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.6.102-syzkaller #0 Not tainted
------------------------------------------------------
syz.2.15109/16283 is trying to acquire lock:
ffff88805e870088 (&of->mutex){+.+.}-{3:3}, at: kernfs_fop_write_iter+0x1e9/0x4d0 fs/kernfs/file.c:325

but task is already holding lock:
ffff888051ae1068 (&pipe->mutex/1){+.+.}-{3:3}, at: iter_file_splice_write+0x1a0/0xc50 fs/splice.c:683

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&pipe->mutex/1){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
       __pipe_lock fs/pipe.c:103 [inline]
       pipe_write+0x1c7/0x1af0 fs/pipe.c:444
       __kernel_write_iter+0x274/0x670 fs/read_write.c:517
       __kernel_write+0xf0/0x140 fs/read_write.c:537
       autofs_write fs/autofs/waitq.c:57 [inline]
       autofs_notify_daemon+0x6ff/0xdc0 fs/autofs/waitq.c:164
       autofs_wait+0x1021/0x1a40 fs/autofs/waitq.c:426
       autofs_mount_wait+0x16b/0x320 fs/autofs/root.c:255
       autofs_d_automount+0x392/0x710 fs/autofs/root.c:401
       follow_automount fs/namei.c:1370 [inline]
       __traverse_mounts+0x2fa/0x5a0 fs/namei.c:1415
       traverse_mounts fs/namei.c:1444 [inline]
       handle_mounts fs/namei.c:1547 [inline]
       step_into+0x526/0xf10 fs/namei.c:1840
       open_last_lookups fs/namei.c:3579 [inline]
       path_openat+0x16bb/0x3190 fs/namei.c:3786
       do_filp_open+0x1c5/0x3d0 fs/namei.c:3816
       do_sys_openat2+0x12c/0x1c0 fs/open.c:1419
       do_sys_open fs/open.c:1434 [inline]
       __do_sys_openat fs/open.c:1450 [inline]
       __se_sys_openat fs/open.c:1445 [inline]
       __x64_sys_openat+0x139/0x160 fs/open.c:1445
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #1 (&sbi->pipe_mutex){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
       autofs_write fs/autofs/waitq.c:55 [inline]
       autofs_notify_daemon+0x6ec/0xdc0 fs/autofs/waitq.c:164
       autofs_wait+0x1021/0x1a40 fs/autofs/waitq.c:426
       autofs_mount_wait+0x16b/0x320 fs/autofs/root.c:255
       autofs_d_automount+0x392/0x710 fs/autofs/root.c:401
       follow_automount fs/namei.c:1370 [inline]
       __traverse_mounts+0x2fa/0x5a0 fs/namei.c:1415
       traverse_mounts fs/namei.c:1444 [inline]
       handle_mounts fs/namei.c:1547 [inline]
       step_into+0x526/0xf10 fs/namei.c:1840
       lookup_last fs/namei.c:2459 [inline]
       path_lookupat+0x169/0x440 fs/namei.c:2483
       filename_lookup+0x1f4/0x510 fs/namei.c:2512
       kern_path+0x35/0x50 fs/namei.c:2610
       lookup_bdev+0xc1/0x280 block/bdev.c:976
       resume_store+0x16a/0x450 kernel/power/hibernate.c:1187
       kernfs_fop_write_iter+0x37d/0x4d0 fs/kernfs/file.c:334
       call_write_iter include/linux/fs.h:2018 [inline]
       new_sync_write fs/read_write.c:491 [inline]
       vfs_write+0x43b/0x940 fs/read_write.c:584
       ksys_write+0x147/0x250 fs/read_write.c:637
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&of->mutex){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3134 [inline]
       check_prevs_add kernel/locking/lockdep.c:3253 [inline]
       validate_chain kernel/locking/lockdep.c:3869 [inline]
       __lock_acquire+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
       lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
       kernfs_fop_write_iter+0x1e9/0x4d0 fs/kernfs/file.c:325
       do_iter_readv_writev fs/read_write.c:-1 [inline]
       do_iter_write+0x79a/0xc70 fs/read_write.c:860
       iter_file_splice_write+0x66f/0xc50 fs/splice.c:736
       do_splice_from fs/splice.c:933 [inline]
       do_splice+0xef0/0x1bf0 fs/splice.c:1292
       __do_splice fs/splice.c:1370 [inline]
       __do_sys_splice fs/splice.c:1586 [inline]
       __se_sys_splice+0x37a/0x470 fs/splice.c:1568
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

Chain exists of:
  &of->mutex --> &sbi->pipe_mutex --> &pipe->mutex/1

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&pipe->mutex/1);
                               lock(&sbi->pipe_mutex);
                               lock(&pipe->mutex/1);
  lock(&of->mutex);

 *** DEADLOCK ***

2 locks held by syz.2.15109/16283:
 #0: ffff88807bafa418 (sb_writers#11){.+.+}-{0:0}, at: __do_splice fs/splice.c:1370 [inline]
 #0: ffff88807bafa418 (sb_writers#11){.+.+}-{0:0}, at: __do_sys_splice fs/splice.c:1586 [inline]
 #0: ffff88807bafa418 (sb_writers#11){.+.+}-{0:0}, at: __se_sys_splice+0x37a/0x470 fs/splice.c:1568
 #1: ffff888051ae1068 (&pipe->mutex/1){+.+.}-{3:3}, at: iter_file_splice_write+0x1a0/0xc50 fs/splice.c:683

stack backtrace:
CPU: 1 PID: 16283 Comm: syz.2.15109 Not tainted 6.6.102-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
 check_noncircular+0x2bd/0x3c0 kernel/locking/lockdep.c:2187
 check_prev_add kernel/locking/lockdep.c:3134 [inline]
 check_prevs_add kernel/locking/lockdep.c:3253 [inline]
 validate_chain kernel/locking/lockdep.c:3869 [inline]
 __lock_acquire+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
 lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
 __mutex_lock_common kernel/locking/mutex.c:603 [inline]
 __mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
 kernfs_fop_write_iter+0x1e9/0x4d0 fs/kernfs/file.c:325
 do_iter_readv_writev fs/read_write.c:-1 [inline]
 do_iter_write+0x79a/0xc70 fs/read_write.c:860
 iter_file_splice_write+0x66f/0xc50 fs/splice.c:736
 do_splice_from fs/splice.c:933 [inline]
 do_splice+0xef0/0x1bf0 fs/splice.c:1292
 __do_splice fs/splice.c:1370 [inline]
 __do_sys_splice fs/splice.c:1586 [inline]
 __se_sys_splice+0x37a/0x470 fs/splice.c:1568
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fb25cb8ebe9
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:00007fb25d93b038 EFLAGS: 00000246 ORIG_RAX: 0000000000000113
RAX: ffffffffffffffda RBX: 00007fb25cdb5fa0 RCX: 00007fb25cb8ebe9
RDX: 0000000000000006 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00007fb25cc11e19 R08: 0000000000000047 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fb25cdb6038 R14: 00007fb25cdb5fa0 R15: 00007ffe80892a18
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/08/27 21:07 linux-6.6.y bb9c90ab9c5a e12e5ba4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in kernfs_fop_write_iter
* Struck through repros no longer work on HEAD.