Hello,
syzbot found the following issue on:
HEAD commit: 2800868f6322 Merge tag 'sound-7.4-rc3' of git://git.kernel..
git tree: upstream
console output:
https://syzkaller.appspot.com/x/log.txt?x=110f4b69580000
kernel config:
https://syzkaller.appspot.com/x/.config?x=1cf189394a856f11
dashboard link:
https://syzkaller.appspot.com/bug?extid=b8ae5f37f5baa84cb085
compiler: gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image (non-bootable):
https://storage.googleapis.com/syzbot-assets/d900f083ada3/non_bootable_disk-2800868f.raw.xz
vmlinux:
https://storage.googleapis.com/syzbot-assets/7a4b1a29003d/vmlinux-2800868f.xz
kernel image:
https://storage.googleapis.com/syzbot-assets/02da498b013d/bzImage-2800868f.xz
AI-generated root cause summary:
A false-positive circular locking dependency is reported by lockdep between the
backing filesystem's freeze protection lock (`sb_writers`), the IMA integrity
cache mutex (`&ima_iint_mutex_key[depth]`), and the upper network filesystem
inode lock (`&sb->s_type->i_mutex_key`). In `do_open()` with `O_TRUNC`,
`mnt_want_write()` is held across `security_file_post_open()`, establishing
`sb_writers -> ima_iint_mutex`. During IMA file measurement on 9p,
`integrity_kernel_read()` takes 9p's `i_rwsem`, establishing `ima_iint_mutex ->
9p i_rwsem`. Finally, truncating a 9p file (`do_truncate()`) flushes dirty pages
through `netfs_writepages()` to cachefiles, where `__cachefiles_write()`
acquires `sb_writers` on the local backing filesystem. Because neither 9p nor
the local backing filesystem increments `s_stack_depth`, their distinct
per-inode `iint->mutex` instances share lockdep class `&ima_iint_mutex_key[0]`,
producing a spurious circular dependency report even though the actual lock
objects differ and cannot deadlock.
full analysis:
https://syzkaller.appspot.com/x/ai_root_cause?x=b8ae5f37f5baa84cb085
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by:
syzbot+b8ae5f...@syzkaller.appspotmail.com
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Tainted: G L
------------------------------------------------------
syz.7.1192/10055 is trying to acquire lock:
ffff88802d3a6478 (sb_writers#5){.+.+}-{0:0}, at: __cachefiles_write+0x56f/0xd40 fs/cachefiles/io.c:355
but task is already holding lock:
ffff88810b968140 (&sb->s_type->i_mutex_key#30){++++}-{4:4}, at: inode_lock_killable include/linux/fs.h:1032 [inline]
ffff88810b968140 (&sb->s_type->i_mutex_key#30){++++}-{4:4}, at: do_truncate+0x14e/0x240 fs/open.c:63
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&sb->s_type->i_mutex_key#30){++++}-{4:4}:
lock_acquire kernel/locking/lockdep.c:5942 [inline]
lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899
down_read_interruptible+0x97/0x520 kernel/locking/rwsem.c:1584
netfs_start_io_read+0x1f/0x100 fs/netfs/locking.c:67
netfs_buffered_read_iter+0xf3/0x190 fs/netfs/buffered_read.c:940
netfs_file_read_iter+0x10f/0x190 fs/netfs/buffered_read.c:978
v9fs_file_read_iter+0x9b/0x100 fs/9p/vfs_file.c:369
__kernel_read+0x397/0xac0 fs/read_write.c:512
integrity_kernel_read+0x7e/0xb0 security/integrity/iint.c:28
ima_calc_file_hash_tfm+0x25e/0x350 security/integrity/ima/ima_crypto.c:222
ima_calc_file_hash+0x1e3/0x380 security/integrity/ima/ima_crypto.c:280
ima_collect_measurement+0x952/0xb30 security/integrity/ima/ima_api.c:300
process_measurement+0xe04/0x2360 security/integrity/ima/ima_main.c:425
ima_file_check+0xbf/0x110 security/integrity/ima/ima_main.c:686
security_file_post_open+0xc4/0x210 security/security.c:2777
do_open fs/namei.c:4853 [inline]
path_openat+0x5d0/0x23f0 fs/namei.c:5016
do_file_open+0x20e/0x430 fs/namei.c:5045
do_sys_openat2+0x163/0x1d0 fs/open.c:1443
do_sys_open fs/open.c:1449 [inline]
__do_sys_open fs/open.c:1457 [inline]
__se_sys_open fs/open.c:1453 [inline]
__x64_sys_open+0xfe/0x1d0 fs/open.c:1453
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #1 (&ima_iint_mutex_key[depth]){+.+.}-{4:4}:
lock_acquire kernel/locking/lockdep.c:5942 [inline]
lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899
__mutex_lock_common kernel/locking/mutex.c:646 [inline]
__mutex_lock+0x19f/0x1c10 kernel/locking/mutex.c:821
process_measurement+0x5ab/0x2360 security/integrity/ima/ima_main.c:319
ima_file_check+0xbf/0x110 security/integrity/ima/ima_main.c:686
security_file_post_open+0xc4/0x210 security/security.c:2777
do_open fs/namei.c:4853 [inline]
path_openat+0x5d0/0x23f0 fs/namei.c:5016
do_file_open+0x20e/0x430 fs/namei.c:5045
do_sys_openat2+0x163/0x1d0 fs/open.c:1443
do_sys_open fs/open.c:1449 [inline]
__do_sys_open fs/open.c:1457 [inline]
__se_sys_open fs/open.c:1453 [inline]
__x64_sys_open+0xfe/0x1d0 fs/open.c:1453
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #0 (sb_writers#5){.+.+}-{0:0}:
check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3209
check_prevs_add kernel/locking/lockdep.c:3328 [inline]
validate_chain kernel/locking/lockdep.c:3952 [inline]
__lock_acquire+0x1528/0x1f40 kernel/locking/lockdep.c:5288
lock_acquire kernel/locking/lockdep.c:5942 [inline]
lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899
percpu_down_read_internal include/linux/percpu-rwsem.h:53 [inline]
percpu_down_read_freezable include/linux/percpu-rwsem.h:83 [inline]
__sb_start_write include/linux/fs/super.h:19 [inline]
sb_start_write include/linux/fs/super.h:125 [inline]
kiocb_start_write include/linux/fs.h:2799 [inline]
vfs_iocb_iter_write+0x1fe/0xa50 fs/read_write.c:929
__cachefiles_write+0x56f/0xd40 fs/cachefiles/io.c:355
cachefiles_write+0xc2/0x150 fs/cachefiles/io.c:395
cachefiles_issue_write+0x513/0x810 fs/cachefiles/io.c:607
netfs_do_issue_write+0xee/0x340 fs/netfs/write_issue.c:256
netfs_issue_write fs/netfs/write_issue.c:290 [inline]
netfs_advance_write fs/netfs/write_issue.c:331 [inline]
netfs_advance_write+0x37e/0x4c0 fs/netfs/write_issue.c:299
netfs_write_folio fs/netfs/write_issue.c:510 [inline]
netfs_writepages+0x10bb/0x2390 fs/netfs/write_issue.c:600
do_writepages+0x278/0x600 mm/page-writeback.c:2562
filemap_writeback+0x22d/0x2e0 mm/filemap.c:386
v9fs_vfs_setattr+0x9d6/0xb80 fs/9p/vfs_inode.c:1087
notify_change+0xb09/0x1350 fs/attr.c:556
do_truncate+0x1df/0x240 fs/open.c:68
handle_truncate fs/namei.c:4306 [inline]
do_open fs/namei.c:4855 [inline]
path_openat+0x1e93/0x23f0 fs/namei.c:5016
do_file_open+0x20e/0x430 fs/namei.c:5045
do_sys_openat2+0x163/0x1d0 fs/open.c:1443
do_sys_open fs/open.c:1449 [inline]
__do_sys_open fs/open.c:1457 [inline]
__se_sys_open fs/open.c:1453 [inline]
__x64_sys_open+0xfe/0x1d0 fs/open.c:1453
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
other info that might help us debug this:
Chain exists of:
sb_writers#5 --> &ima_iint_mutex_key[depth] --> &sb->s_type->i_mutex_key#30
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&sb->s_type->i_mutex_key#30);
lock(&ima_iint_mutex_key[depth]);
lock(&sb->s_type->i_mutex_key#30);
rlock(sb_writers#5);
*** DEADLOCK ***
locks held by syz.7.1192/10055: 2, on CPU#0:
#0: ffff88802ed0c478 (sb_writers#15){.+.+}-{0:0}, at: do_open fs/namei.c:4838 [inline]
#0: ffff88802ed0c478 (sb_writers#15){.+.+}-{0:0}, at: path_openat+0x1920/0x23f0 fs/namei.c:5016
#1: ffff88810b968140 (&sb->s_type->i_mutex_key#30){++++}-{4:4}, at: inode_lock_killable include/linux/fs.h:1032 [inline]
#1: ffff88810b968140 (&sb->s_type->i_mutex_key#30){++++}-{4:4}, at: do_truncate+0x14e/0x240 fs/open.c:63
stack backtrace:
CPU: 0 UID: 0 PID: 10055 Comm: syz.7.1192 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120
print_circular_bug.cold+0x178/0x1be kernel/locking/lockdep.c:2087
check_noncircular+0x146/0x160 kernel/locking/lockdep.c:2219
check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3209
check_prevs_add kernel/locking/lockdep.c:3328 [inline]
validate_chain kernel/locking/lockdep.c:3952 [inline]
__lock_acquire+0x1528/0x1f40 kernel/locking/lockdep.c:5288
lock_acquire kernel/locking/lockdep.c:5942 [inline]
lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899
percpu_down_read_internal include/linux/percpu-rwsem.h:53 [inline]
percpu_down_read_freezable include/linux/percpu-rwsem.h:83 [inline]
__sb_start_write include/linux/fs/super.h:19 [inline]
sb_start_write include/linux/fs/super.h:125 [inline]
kiocb_start_write include/linux/fs.h:2799 [inline]
vfs_iocb_iter_write+0x1fe/0xa50 fs/read_write.c:929
__cachefiles_write+0x56f/0xd40 fs/cachefiles/io.c:355
cachefiles_write+0xc2/0x150 fs/cachefiles/io.c:395
cachefiles_issue_write+0x513/0x810 fs/cachefiles/io.c:607
netfs_do_issue_write+0xee/0x340 fs/netfs/write_issue.c:256
netfs_issue_write fs/netfs/write_issue.c:290 [inline]
netfs_advance_write fs/netfs/write_issue.c:331 [inline]
netfs_advance_write+0x37e/0x4c0 fs/netfs/write_issue.c:299
netfs_write_folio fs/netfs/write_issue.c:510 [inline]
netfs_writepages+0x10bb/0x2390 fs/netfs/write_issue.c:600
do_writepages+0x278/0x600 mm/page-writeback.c:2562
filemap_writeback+0x22d/0x2e0 mm/filemap.c:386
v9fs_vfs_setattr+0x9d6/0xb80 fs/9p/vfs_inode.c:1087
notify_change+0xb09/0x1350 fs/attr.c:556
do_truncate+0x1df/0x240 fs/open.c:68
handle_truncate fs/namei.c:4306 [inline]
do_open fs/namei.c:4855 [inline]
path_openat+0x1e93/0x23f0 fs/namei.c:5016
do_file_open+0x20e/0x430 fs/namei.c:5045
do_sys_openat2+0x163/0x1d0 fs/open.c:1443
do_sys_open fs/open.c:1449 [inline]
__do_sys_open fs/open.c:1457 [inline]
__se_sys_open fs/open.c:1453 [inline]
__x64_sys_open+0xfe/0x1d0 fs/open.c:1453
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f4b4eba94d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f4b4f9a7028 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 00007f4b4ee25fa0 RCX: 00007f4b4eba94d9
RDX: 000000000000015b RSI: 00000000001e3342 RDI: 00002000000009c0
RBP: 00007f4b4ec3804e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f4b4ee26038 R14: 00007f4b4ee25fa0 R15: 00007ffd7b80c5f8
</TASK>
---
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