================================ WARNING: inconsistent lock state 5.16.0-rc2-syzkaller #0 Not tainted -------------------------------- inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage. syz-executor.0/25135 [HC1[1]:SC0[0]:HE0:SE1] takes: ffff888071bd2418 (&ctx->timeout_lock){?.+.}-{2:2}, at: io_timeout_fn+0x6f/0x360 fs/io_uring.c:5943 {HARDIRQ-ON-W} state was registered at: __trace_hardirqs_on_caller kernel/locking/lockdep.c:4224 [inline] lockdep_hardirqs_on_prepare kernel/locking/lockdep.c:4292 [inline] lockdep_hardirqs_on_prepare+0x135/0x400 kernel/locking/lockdep.c:4244 trace_hardirqs_on+0x5b/0x1c0 kernel/trace/trace_preemptirq.c:49 __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:159 [inline] _raw_spin_unlock_irq+0x1f/0x40 kernel/locking/spinlock.c:202 spin_unlock_irq include/linux/spinlock.h:399 [inline] __io_poll_remove_one fs/io_uring.c:5669 [inline] __io_poll_remove_one fs/io_uring.c:5654 [inline] io_poll_remove_one+0x236/0x870 fs/io_uring.c:5680 io_poll_remove_all+0x1af/0x235 fs/io_uring.c:5709 io_ring_ctx_wait_and_kill+0x1cc/0x322 fs/io_uring.c:9534 io_uring_release+0x42/0x46 fs/io_uring.c:9554 __fput+0x286/0x9f0 fs/file_table.c:280 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 exit_task_work include/linux/task_work.h:32 [inline] do_exit+0xc14/0x2b40 kernel/exit.c:832 do_group_exit+0x125/0x310 kernel/exit.c:929 __do_sys_exit_group kernel/exit.c:940 [inline] __se_sys_exit_group kernel/exit.c:938 [inline] __x64_sys_exit_group+0x3a/0x50 kernel/exit.c:938 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae irq event stamp: 13302 hardirqs last enabled at (13301): [] __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:159 [inline] hardirqs last enabled at (13301): [] _raw_spin_unlock_irq+0x1f/0x40 kernel/locking/spinlock.c:202 hardirqs last disabled at (13302): [] sysvec_apic_timer_interrupt+0xb/0xc0 arch/x86/kernel/apic/apic.c:1097 softirqs last enabled at (13142): [] invoke_softirq kernel/softirq.c:432 [inline] softirqs last enabled at (13142): [] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:636 softirqs last disabled at (13131): [] invoke_softirq kernel/softirq.c:432 [inline] softirqs last disabled at (13131): [] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:636 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&ctx->timeout_lock); lock(&ctx->timeout_lock); *** DEADLOCK *** 1 lock held by syz-executor.0/25135: #0: ffffffff8bb83ca0 (rcu_read_lock){....}-{1:2}, at: percpu_ref_put_many+0x0/0x260 arch/x86/include/asm/bitops.h:207 stack backtrace: CPU: 0 PID: 25135 Comm: syz-executor.0 Not tainted 5.16.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_usage_bug kernel/locking/lockdep.c:203 [inline] valid_state kernel/locking/lockdep.c:3945 [inline] mark_lock_irq kernel/locking/lockdep.c:4148 [inline] mark_lock.cold+0x61/0x8e kernel/locking/lockdep.c:4605 mark_usage kernel/locking/lockdep.c:4497 [inline] __lock_acquire+0x149d/0x54a0 kernel/locking/lockdep.c:4981 lock_acquire kernel/locking/lockdep.c:5637 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5602 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:162 io_timeout_fn+0x6f/0x360 fs/io_uring.c:5943 __run_hrtimer kernel/time/hrtimer.c:1685 [inline] __hrtimer_run_queues+0x609/0xe50 kernel/time/hrtimer.c:1749 hrtimer_interrupt+0x31c/0x790 kernel/time/hrtimer.c:1811 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1086 [inline] __sysvec_apic_timer_interrupt+0x146/0x530 arch/x86/kernel/apic/apic.c:1103 sysvec_apic_timer_interrupt+0x8e/0xc0 arch/x86/kernel/apic/apic.c:1097 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:638 RIP: 0010:get_current arch/x86/include/asm/current.h:15 [inline] RIP: 0010:__rcu_read_unlock+0x7/0x570 kernel/rcu/tree_plugin.h:416 Code: 00 48 8b 44 24 08 4c 8b 04 24 e9 c8 fd ff ff e8 3f 50 5a 00 e9 8a fd ff ff 66 2e 0f 1f 84 00 00 00 00 00 41 56 41 55 41 54 55 <65> 48 8b 2c 25 40 70 02 00 53 48 8d bd 3c 04 00 00 48 b8 00 00 00 RSP: 0018:ffffc90016a8fdb0 EFLAGS: 00000216 RAX: 00000000000168e5 RBX: 0000607f46067fe8 RCX: ffffc90002ce1000 RDX: 0000000000040000 RSI: ffffffff81e0cbe1 RDI: 0000000000000003 RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000001 R10: ffffffff81e0cbd7 R11: 0000000000000000 R12: ffffffffffffffff R13: 0000000000000000 R14: 0000000000000001 R15: ffff88808e6d5a00 rcu_read_unlock include/linux/rcupdate.h:720 [inline] percpu_ref_put_many+0x156/0x260 include/linux/percpu-refcount.h:337 percpu_ref_put include/linux/percpu-refcount.h:351 [inline] ctx_flush_and_put fs/io_uring.c:2169 [inline] tctx_task_work+0x4fd/0x630 fs/io_uring.c:2213 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 tracehook_notify_signal include/linux/tracehook.h:214 [inline] handle_signal_work kernel/entry/common.c:146 [inline] exit_to_user_mode_loop kernel/entry/common.c:172 [inline] exit_to_user_mode_prepare+0x256/0x290 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f26f1c81ae9 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f26ef1f7188 EFLAGS: 00000246 ORIG_RAX: 00000000000001aa RAX: 000000000000014a RBX: 00007f26f1d94f60 RCX: 00007f26f1c81ae9 RDX: 0000000000000000 RSI: 000000000000014a RDI: 0000000000000003 RBP: 00007f26f1cdbf6d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f26f22c8b2f R14: 00007f26ef1f7300 R15: 0000000000022000 ---------------- Code disassembly (best guess): 0: 00 48 8b add %cl,-0x75(%rax) 3: 44 24 08 rex.R and $0x8,%al 6: 4c 8b 04 24 mov (%rsp),%r8 a: e9 c8 fd ff ff jmpq 0xfffffdd7 f: e8 3f 50 5a 00 callq 0x5a5053 14: e9 8a fd ff ff jmpq 0xfffffda3 19: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1) 20: 00 00 00 23: 41 56 push %r14 25: 41 55 push %r13 27: 41 54 push %r12 29: 55 push %rbp * 2a: 65 48 8b 2c 25 40 70 mov %gs:0x27040,%rbp <-- trapping instruction 31: 02 00 33: 53 push %rbx 34: 48 8d bd 3c 04 00 00 lea 0x43c(%rbp),%rdi 3b: 48 rex.W 3c: b8 .byte 0xb8 3d: 00 00 add %al,(%rax)