[v6.6] possible deadlock in process_measurement

0 views
Skip to first unread message

syzbot

unread,
3:52 AM (4 hours ago) 3:52 AM
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: d27334b2888c Linux 6.6.151
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=15846079580000
kernel config: https://syzkaller.appspot.com/x/.config?x=f0bc3d90c30838b5
dashboard link: https://syzkaller.appspot.com/bug?extid=e9278746ae9abcd52896
compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/695139abd971/disk-d27334b2.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/b11fc121442a/vmlinux-d27334b2.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e226f54f9286/bzImage-d27334b2.xz

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

======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.1.1236/11503 is trying to acquire lock:
ffff888069237770 (&iint_mutex_key[depth]){+.+.}-{3:3}, at: process_measurement+0x739/0x1d50 security/integrity/ima/ima_main.c:275

but task is already holding lock:
ffff88806b6df070 (&subsys->lock){+.+.}-{3:3}, at: nvmet_ns_enable+0x4d/0x8c0 drivers/nvme/target/core.c:561

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&subsys->lock){+.+.}-{3:3}:
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x135/0xc80 kernel/locking/mutex.c:747
nvmet_ns_device_path_store+0x54/0x150 drivers/nvme/target/configfs.c:350
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x312/0x400 fs/configfs/file.c:229
call_write_iter include/linux/fs.h:2018 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x474/0x9a0 fs/read_write.c:584
ksys_write+0x151/0x260 fs/read_write.c:637
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #1 (&p->frag_sem){.+.+}-{3:3}:
down_read+0x46/0x2e0 kernel/locking/rwsem.c:1520
__configfs_open_file+0xd8/0x7d0 fs/configfs/file.c:304
do_dentry_open+0x880/0x14b0 fs/open.c:929
vfs_open fs/open.c:1065 [inline]
dentry_open+0xbb/0x100 fs/open.c:1079
ima_calc_file_hash+0x190/0x1960 security/integrity/ima/ima_crypto.c:558
ima_collect_measurement+0x4d4/0xa30 security/integrity/ima/ima_api.c:290
process_measurement+0x123a/0x1d50 security/integrity/ima/ima_main.c:370
ima_file_check+0xcc/0x110 security/integrity/ima/ima_main.c:568
do_open fs/namei.c:3685 [inline]
path_openat+0x2910/0x3270 fs/namei.c:3844
do_filp_open+0x1f2/0x430 fs/namei.c:3871
do_sys_openat2+0x134/0x1d0 fs/open.c:1422
do_sys_open fs/open.c:1437 [inline]
__do_sys_openat fs/open.c:1453 [inline]
__se_sys_openat fs/open.c:1448 [inline]
__x64_sys_openat+0x139/0x160 fs/open.c:1448
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&iint_mutex_key[depth]){+.+.}-{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+0x37ef/0x7d80 kernel/locking/lockdep.c:5137
lock_acquire+0x19e/0x420 kernel/locking/lockdep.c:5754
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x135/0xc80 kernel/locking/mutex.c:747
process_measurement+0x739/0x1d50 security/integrity/ima/ima_main.c:275
ima_file_check+0xcc/0x110 security/integrity/ima/ima_main.c:568
do_open fs/namei.c:3685 [inline]
path_openat+0x2910/0x3270 fs/namei.c:3844
do_filp_open+0x1f2/0x430 fs/namei.c:3871
file_open_name fs/open.c:1367 [inline]
filp_open+0x180/0x1e0 fs/open.c:1387
nvmet_file_ns_enable+0x74/0x330 drivers/nvme/target/io-cmd-file.c:41
nvmet_ns_enable+0xf4/0x8c0 drivers/nvme/target/core.c:578
nvmet_ns_enable_store+0xd8/0x170 drivers/nvme/target/configfs.c:549
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x312/0x400 fs/configfs/file.c:229
call_write_iter include/linux/fs.h:2018 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x474/0x9a0 fs/read_write.c:584
ksys_write+0x151/0x260 fs/read_write.c:637
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

Chain exists of:
&iint_mutex_key[depth] --> &p->frag_sem --> &subsys->lock

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&subsys->lock);
lock(&p->frag_sem);
lock(&subsys->lock);
lock(&iint_mutex_key[depth]);

*** DEADLOCK ***

6 locks held by syz.1.1236/11503:
#0: ffff8880288240c8 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x2a3/0x330 fs/file.c:1040
#1: ffff888018be0418 (sb_writers#18){.+.+}-{0:0}, at: vfs_write+0x21e/0x9a0 fs/read_write.c:580
#2: ffff88802df14c88 (&buffer->mutex#2){+.+.}-{3:3}, at: configfs_write_iter+0x81/0x400 fs/configfs/file.c:226
#3: ffff888065562d78 (&p->frag_sem){.+.+}-{3:3}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
#3: ffff888065562d78 (&p->frag_sem){.+.+}-{3:3}, at: configfs_write_iter+0x215/0x400 fs/configfs/file.c:229
#4: ffffffff8daee6d0 (nvmet_config_sem){+.+.}-{3:3}, at: nvmet_ns_enable_store+0xc9/0x170 drivers/nvme/target/configfs.c:547
#5: ffff88806b6df070 (&subsys->lock){+.+.}-{3:3}, at: nvmet_ns_enable+0x4d/0x8c0 drivers/nvme/target/core.c:561

stack backtrace:
CPU: 1 PID: 11503 Comm: syz.1.1236 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Call Trace:
<TASK>
dump_stack_lvl+0x18c/0x250 lib/dump_stack.c:106
check_noncircular+0x2fc/0x400 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+0x37ef/0x7d80 kernel/locking/lockdep.c:5137
lock_acquire+0x19e/0x420 kernel/locking/lockdep.c:5754
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x135/0xc80 kernel/locking/mutex.c:747
process_measurement+0x739/0x1d50 security/integrity/ima/ima_main.c:275
ima_file_check+0xcc/0x110 security/integrity/ima/ima_main.c:568
do_open fs/namei.c:3685 [inline]
path_openat+0x2910/0x3270 fs/namei.c:3844
do_filp_open+0x1f2/0x430 fs/namei.c:3871
file_open_name fs/open.c:1367 [inline]
filp_open+0x180/0x1e0 fs/open.c:1387
nvmet_file_ns_enable+0x74/0x330 drivers/nvme/target/io-cmd-file.c:41
nvmet_ns_enable+0xf4/0x8c0 drivers/nvme/target/core.c:578
nvmet_ns_enable_store+0xd8/0x170 drivers/nvme/target/configfs.c:549
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x312/0x400 fs/configfs/file.c:229
call_write_iter include/linux/fs.h:2018 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x474/0x9a0 fs/read_write.c:584
ksys_write+0x151/0x260 fs/read_write.c:637
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f95d179e0d9
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:00007f95d259b028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f95d1a25fa0 RCX: 00007f95d179e0d9
RDX: 0000000000000001 RSI: 0000200000000580 RDI: 0000000000000008
RBP: 00007f95d1835024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f95d1a26038 R14: 00007f95d1a25fa0 R15: 00007ffef3291448
</TASK>
nvme nvme0: creating 2 I/O queues.
nvme nvme0: new ctrl: "testnqn"


---
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
Reply all
Reply to author
Forward
0 new messages