[v5.15] possible deadlock in kernfs_fop_write_iter (2)

3 views
Skip to first unread message

syzbot

unread,
Jun 1, 2025, 5:33:37 AM6/1/25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 98f47d0e9b8c Linux 5.15.184
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14a3300c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=6d966a9f787a9782
dashboard link: https://syzkaller.appspot.com/bug?extid=c814aa406cfbf5f58583
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/5e51314fa9b0/disk-98f47d0e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/3348ed80ea4e/vmlinux-98f47d0e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/3e02a814f2cc/bzImage-98f47d0e.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+c814aa...@syzkaller.appspotmail.com

======================================================
WARNING: possible circular locking dependency detected
5.15.184-syzkaller #0 Not tainted
------------------------------------------------------
syz.6.737/8212 is trying to acquire lock:
ffff888062b69488 (&of->mutex){+.+.}-{3:3}, at: kernfs_fop_write_iter+0x1e5/0x4c0 fs/kernfs/file.c:287

but task is already holding lock:
ffff888077372868 (&pipe->mutex/1){+.+.}-{3:3}, at: iter_file_splice_write+0x195/0xc40 fs/splice.c:635

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #7 (&pipe->mutex/1){+.+.}-{3:3}:
__mutex_lock_common+0x1eb/0x2390 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
iter_file_splice_write+0x195/0xc40 fs/splice.c:635
do_splice_from fs/splice.c:767 [inline]
do_splice+0xe65/0x1640 fs/splice.c:1079
__do_splice fs/splice.c:1144 [inline]
__do_sys_splice fs/splice.c:1350 [inline]
__se_sys_splice+0x327/0x410 fs/splice.c:1332
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #6 (sb_writers#3){.+.+}-{0:0}:
percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
__sb_start_write include/linux/fs.h:1811 [inline]
sb_start_write include/linux/fs.h:1881 [inline]
file_start_write include/linux/fs.h:3042 [inline]
lo_write_bvec+0x193/0x770 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:2235 [inline]
loop_process_work+0x1d62/0x2480 drivers/block/loop.c:2275
process_one_work+0x863/0x1000 kernel/workqueue.c:2310
worker_thread+0xaa8/0x12a0 kernel/workqueue.c:2457
kthread+0x436/0x520 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

-> #5 ((work_completion)(&worker->work)){+.+.}-{0:0}:
process_one_work+0x7bf/0x1000 kernel/workqueue.c:2286
worker_thread+0xaa8/0x12a0 kernel/workqueue.c:2457
kthread+0x436/0x520 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

-> #4 ((wq_completion)loop5){+.+.}-{0:0}:
flush_workqueue+0x142/0x1380 kernel/workqueue.c:2830
drain_workqueue+0xcf/0x380 kernel/workqueue.c:2995
destroy_workqueue+0x7b/0xb20 kernel/workqueue.c:4439
__loop_clr_fd+0x234/0xb90 drivers/block/loop.c:1384
blkdev_put_whole block/bdev.c:692 [inline]
blkdev_put+0x53f/0x7d0 block/bdev.c:957
btrfs_close_bdev fs/btrfs/volumes.c:1189 [inline]
btrfs_close_one_device fs/btrfs/volumes.c:1210 [inline]
close_fs_devices+0x48a/0x930 fs/btrfs/volumes.c:1253
btrfs_close_devices+0xc2/0x500 fs/btrfs/volumes.c:1268
close_ctree+0x75f/0x8c0 fs/btrfs/disk-io.c:4538
generic_shutdown_super+0x130/0x300 fs/super.c:475
kill_anon_super+0x36/0x70 fs/super.c:1089
btrfs_kill_super+0x3d/0x50 fs/btrfs/super.c:2390
deactivate_locked_super+0x93/0xf0 fs/super.c:335
cleanup_mnt+0x418/0x4d0 fs/namespace.c:1143
task_work_run+0x125/0x1a0 kernel/task_work.c:188
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop+0x10f/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+0x16/0x40 kernel/entry/common.c:307
do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #3 (&lo->lo_mutex){+.+.}-{3:3}:
__mutex_lock_common+0x1eb/0x2390 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+0x6a/0x100 drivers/block/loop.c:2056
blkdev_get_whole+0x90/0x390 block/bdev.c:669
blkdev_get_by_dev+0x2d0/0xa60 block/bdev.c:827
blkdev_open+0x12d/0x2c0 block/fops.c:466
do_dentry_open+0x7ff/0xf80 fs/open.c:826
do_open fs/namei.c:3608 [inline]
path_openat+0x2682/0x2f30 fs/namei.c:3742
do_filp_open+0x1b3/0x3e0 fs/namei.c:3769
do_sys_openat2+0x142/0x4a0 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+0x135/0x160 fs/open.c:1280
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #2 (&disk->open_mutex){+.+.}-{3:3}:
__mutex_lock_common+0x1eb/0x2390 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+0x157/0xa60 block/bdev.c:820
swsusp_check+0x9b/0x2a0 kernel/power/swap.c:1526
software_resume+0xc6/0x3b0 kernel/power/hibernate.c:982
resume_store+0xe4/0x130 kernel/power/hibernate.c:1184
kernfs_fop_write_iter+0x379/0x4c0 fs/kernfs/file.c:296
call_write_iter include/linux/fs.h:2172 [inline]
new_sync_write fs/read_write.c:507 [inline]
vfs_write+0x712/0xd00 fs/read_write.c:594
ksys_write+0x14d/0x250 fs/read_write.c:647
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #1 (system_transition_mutex/1){+.+.}-{3:3}:
__mutex_lock_common+0x1eb/0x2390 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/0x3b0 kernel/power/hibernate.c:937
resume_store+0xe4/0x130 kernel/power/hibernate.c:1184
kernfs_fop_write_iter+0x379/0x4c0 fs/kernfs/file.c:296
call_write_iter include/linux/fs.h:2172 [inline]
new_sync_write fs/read_write.c:507 [inline]
vfs_write+0x712/0xd00 fs/read_write.c:594
ksys_write+0x14d/0x250 fs/read_write.c:647
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #0 (&of->mutex){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3788 [inline]
__lock_acquire+0x2c33/0x7c60 kernel/locking/lockdep.c:5012
lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623
__mutex_lock_common+0x1eb/0x2390 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
kernfs_fop_write_iter+0x1e5/0x4c0 fs/kernfs/file.c:287
do_iter_readv_writev+0x497/0x600 fs/read_write.c:-1
do_iter_write+0x205/0x7b0 fs/read_write.c:855
iter_file_splice_write+0x65f/0xc40 fs/splice.c:689
do_splice_from fs/splice.c:767 [inline]
do_splice+0xe65/0x1640 fs/splice.c:1079
__do_splice fs/splice.c:1144 [inline]
__do_sys_splice fs/splice.c:1350 [inline]
__se_sys_splice+0x327/0x410 fs/splice.c:1332
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

other info that might help us debug this:

Chain exists of:
&of->mutex --> sb_writers#3 --> &pipe->mutex/1

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&pipe->mutex/1);
lock(sb_writers#3);
lock(&pipe->mutex/1);
lock(&of->mutex);

*** DEADLOCK ***

2 locks held by syz.6.737/8212:
#0: ffff88807f428460 (sb_writers#8){.+.+}-{0:0}, at: __do_splice fs/splice.c:1144 [inline]
#0: ffff88807f428460 (sb_writers#8){.+.+}-{0:0}, at: __do_sys_splice fs/splice.c:1350 [inline]
#0: ffff88807f428460 (sb_writers#8){.+.+}-{0:0}, at: __se_sys_splice+0x327/0x410 fs/splice.c:1332
#1: ffff888077372868 (&pipe->mutex/1){+.+.}-{3:3}, at: iter_file_splice_write+0x195/0xc40 fs/splice.c:635

stack backtrace:
CPU: 0 PID: 8212 Comm: syz.6.737 Not tainted 5.15.184-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
<TASK>
dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106
check_noncircular+0x274/0x310 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 kernel/locking/lockdep.c:3788 [inline]
__lock_acquire+0x2c33/0x7c60 kernel/locking/lockdep.c:5012
lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623
__mutex_lock_common+0x1eb/0x2390 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
kernfs_fop_write_iter+0x1e5/0x4c0 fs/kernfs/file.c:287
do_iter_readv_writev+0x497/0x600 fs/read_write.c:-1
do_iter_write+0x205/0x7b0 fs/read_write.c:855
iter_file_splice_write+0x65f/0xc40 fs/splice.c:689
do_splice_from fs/splice.c:767 [inline]
do_splice+0xe65/0x1640 fs/splice.c:1079
__do_splice fs/splice.c:1144 [inline]
__do_sys_splice fs/splice.c:1350 [inline]
__se_sys_splice+0x327/0x410 fs/splice.c:1332
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f3ab9e8d969
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:00007f3ab7cd4038 EFLAGS: 00000246 ORIG_RAX: 0000000000000113
RAX: ffffffffffffffda RBX: 00007f3aba0b5080 RCX: 00007f3ab9e8d969
RDX: 0000000000000009 RSI: 0000000000000000 RDI: 0000000000000007
RBP: 00007f3ab9f0fab1 R08: 000000000000bfd1 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000001 R14: 00007f3aba0b5080 R15: 00007fff63573388
</TASK>
set kvm_intel.dump_invalid_vmcs=1 to dump internal KVM state.
bridge0: port 2(bridge_slave_1) entered disabled state
device bridge_slave_1 left promiscuous mode
bridge0: port 2(bridge_slave_1) entered disabled state


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Sep 9, 2025, 5:34:18 AM9/9/25
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages