[syzbot] [kernfs?] BUG: using __this_cpu_add() in preemptible code in kernfs_fop_write_iter

From: syzbot
Date: Mon Apr 15 2024 - 20:37:33 EST


Hello,

syzbot found the following issue on:

HEAD commit: fe46a7dd189e Merge tag 'sound-6.9-rc1' of git://git.kernel..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17c96661180000
kernel config: https://syzkaller.appspot.com/x/.config?x=1a07d5da4eb21586
dashboard link: https://syzkaller.appspot.com/bug?extid=ef8020e2f85fb6335ed1
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/b42ab0fd4947/disk-fe46a7dd.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/b8a6e7231930/vmlinux-fe46a7dd.xz
kernel image: https://storage.googleapis.com/syzbot-assets/4fbf3e4ce6f8/bzImage-fe46a7dd.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+ef8020e2f85fb6335ed1@xxxxxxxxxxxxxxxxxxxxxxxxx

BUG: using __this_cpu_add() in preemptible [00000000] code: syz-executor.1/5775
caller is __pv_queued_spin_lock_slowpath+0x272/0xc80 kernel/locking/qspinlock.c:565
CPU: 1 PID: 5775 Comm: syz-executor.1 Not tainted 6.8.0-syzkaller-08951-gfe46a7dd189e #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x16c/0x1f0 lib/dump_stack.c:114
check_preemption_disabled+0xd0/0xe0 lib/smp_processor_id.c:49
__pv_queued_spin_lock_slowpath+0x272/0xc80 kernel/locking/qspinlock.c:565
pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:584 [inline]
queued_spin_lock_slowpath arch/x86/include/asm/qspinlock.h:51 [inline]
queued_spin_lock include/asm-generic/qspinlock.h:114 [inline]
lockdep_lock+0x1b8/0x200 kernel/locking/lockdep.c:144
graph_lock kernel/locking/lockdep.c:170 [inline]
lookup_chain_cache_add kernel/locking/lockdep.c:3804 [inline]
validate_chain kernel/locking/lockdep.c:3837 [inline]
__lock_acquire+0x15a8/0x3b30 kernel/locking/lockdep.c:5137
lock_acquire kernel/locking/lockdep.c:5754 [inline]
lock_acquire+0x1b1/0x540 kernel/locking/lockdep.c:5719
__might_fault mm/memory.c:6080 [inline]
__might_fault+0x11b/0x190 mm/memory.c:6073
_copy_from_iter+0x1c4/0x1110 lib/iov_iter.c:259
copy_from_iter include/linux/uio.h:204 [inline]
kernfs_fop_write_iter+0x1a3/0x500 fs/kernfs/file.c:315
call_write_iter include/linux/fs.h:2108 [inline]
new_sync_write fs/read_write.c:497 [inline]
vfs_write+0x6de/0x1100 fs/read_write.c:590
ksys_write+0x12f/0x260 fs/read_write.c:643
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xd5/0x260 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x6d/0x75
RIP: 0033:0x7f2e4ea7de69
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f2e4f7ab0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f2e4ebabf80 RCX: 00007f2e4ea7de69
RDX: 0000000000000012 RSI: 0000000020000380 RDI: 0000000000000004
RBP: 00007f2e4eaca47a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f2e4ebabf80 R15: 00007ffd0de416f8
</TASK>
------------[ cut here ]------------
DEBUG_LOCKS_WARN_ON(!irqs_disabled())
WARNING: CPU: 1 PID: 5775 at kernel/locking/lockdep.c:150 lockdep_unlock+0x1c1/0x290 kernel/locking/lockdep.c:150
Modules linked in:
CPU: 1 PID: 5775 Comm: syz-executor.1 Not tainted 6.8.0-syzkaller-08951-gfe46a7dd189e #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
RIP: 0010:lockdep_unlock+0x1c1/0x290 kernel/locking/lockdep.c:150
Code: d0 7c 08 84 d2 0f 85 cc 00 00 00 8b 35 8c d2 33 0e 85 f6 75 19 90 48 c7 c6 e0 c7 0c 8b 48 c7 c7 60 c7 0c 8b e8 10 4e e5 ff 90 <0f> 0b 90 90 90 e9 80 fe ff ff 90 0f 0b 90 e8 0c b6 0a 03 85 c0 74
RSP: 0018:ffffc9000329f940 EFLAGS: 00010282
RAX: 0000000000000000 RBX: ffffffff9469aaa0 RCX: ffffc9000996a000
RDX: 0000000000040000 RSI: ffffffff8150f3f6 RDI: 0000000000000001
RBP: 0000000000000002 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000001 R12: ffff888020288000
R13: ffffffff9400a9b8 R14: ffff888020288b28 R15: 0000000000000001
FS: 00007f2e4f7ab6c0(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f2e4eada5b2 CR3: 0000000062612000 CR4: 0000000000350ef0
Call Trace:
<TASK>
graph_unlock kernel/locking/lockdep.c:186 [inline]
validate_chain kernel/locking/lockdep.c:3873 [inline]
__lock_acquire+0x1fb0/0x3b30 kernel/locking/lockdep.c:5137
lock_acquire kernel/locking/lockdep.c:5754 [inline]
lock_acquire+0x1b1/0x540 kernel/locking/lockdep.c:5719
__might_fault mm/memory.c:6080 [inline]
__might_fault+0x11b/0x190 mm/memory.c:6073
_copy_from_iter+0x1c4/0x1110 lib/iov_iter.c:259
copy_from_iter include/linux/uio.h:204 [inline]
kernfs_fop_write_iter+0x1a3/0x500 fs/kernfs/file.c:315
call_write_iter include/linux/fs.h:2108 [inline]
new_sync_write fs/read_write.c:497 [inline]
vfs_write+0x6de/0x1100 fs/read_write.c:590
ksys_write+0x12f/0x260 fs/read_write.c:643
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xd5/0x260 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x6d/0x75
RIP: 0033:0x7f2e4ea7de69
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f2e4f7ab0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f2e4ebabf80 RCX: 00007f2e4ea7de69
RDX: 0000000000000012 RSI: 0000000020000380 RDI: 0000000000000004
RBP: 00007f2e4eaca47a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f2e4ebabf80 R15: 00007ffd0de416f8
</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 syzkaller@xxxxxxxxxxxxxxxx.

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