================================ WARNING: inconsistent lock state 5.16.0-rc2-syzkaller #0 Not tainted -------------------------------- inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage. syz-executor.2/15910 [HC1[1]:SC0[0]:HE0:SE1] takes: ffff888018983418 (&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 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:175 [inline] exit_to_user_mode_prepare+0x27e/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 irq event stamp: 3054 hardirqs last enabled at (3053): [] mod_memcg_lruvec_state include/linux/memcontrol.h:1054 [inline] hardirqs last enabled at (3053): [] mod_objcg_mlstate+0x1f4/0x240 mm/memcontrol.c:793 hardirqs last disabled at (3054): [] sysvec_apic_timer_interrupt+0xb/0xc0 arch/x86/kernel/apic/apic.c:1097 softirqs last enabled at (1818): [] invoke_softirq kernel/softirq.c:432 [inline] softirqs last enabled at (1818): [] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:636 softirqs last disabled at (1759): [] invoke_softirq kernel/softirq.c:432 [inline] softirqs last disabled at (1759): [] __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 *** 2 locks held by syz-executor.2/15910: #0: ffff8880189830a8 (&ctx->uring_lock){+.+.}-{3:3}, at: __do_sys_io_uring_enter+0xf60/0x1f50 fs/io_uring.c:10042 #1: ffffffff8bb81120 (rcu_read_lock){....}-{1:2}, at: reciprocal_divide include/linux/reciprocal_div.h:36 [inline] #1: ffffffff8bb81120 (rcu_read_lock){....}-{1:2}, at: obj_to_index include/linux/slab_def.h:112 [inline] #1: ffffffff8bb81120 (rcu_read_lock){....}-{1:2}, at: memcg_slab_post_alloc_hook+0xd0/0x3e0 mm/slab.h:319 stack backtrace: CPU: 3 PID: 15910 Comm: syz-executor.2 Not tainted 5.16.0-rc2-syzkaller #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 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:check_preemption_disabled+0x41/0x170 lib/smp_processor_id.c:56 Code: ed 26 be 76 65 8b 1d 5e 81 be 76 81 e3 ff ff ff 7f 31 ff 89 de 0f 1f 44 00 00 85 db 74 11 0f 1f 44 00 00 44 89 e0 5b 5d 41 5c <41> 5d 41 5e c3 0f 1f 44 00 00 9c 5b 81 e3 00 02 00 00 31 ff 48 89 RSP: 0018:ffffc90003987a80 EFLAGS: 00000202 RAX: 0000000000000003 RBX: 0000000000000006 RCX: 70bceb37dfc5df82 RDX: 1ffff110048d7953 RSI: 0000000000000001 RDI: 0000000000000000 RBP: ffff8880166c4800 R08: 0000000000000000 R09: ffffffff8ff74a07 R10: fffffbfff1fee940 R11: 000000000000003f R12: ffff888024d33480 R13: ffffffff8a049120 R14: ffffc90003987c60 R15: ffffea0001c01c00 rcu_dynticks_curr_cpu_in_eqs kernel/rcu/tree.c:330 [inline] rcu_is_watching+0xe/0xb0 kernel/rcu/tree.c:1121 rcu_read_lock include/linux/rcupdate.h:689 [inline] percpu_ref_get_many include/linux/percpu-refcount.h:202 [inline] percpu_ref_get include/linux/percpu-refcount.h:222 [inline] obj_cgroup_get include/linux/memcontrol.h:825 [inline] memcg_slab_post_alloc_hook+0xff/0x3e0 mm/slab.h:320 slab_post_alloc_hook mm/slab.h:526 [inline] kmem_cache_alloc_bulk+0x34a/0x480 mm/slab.c:3554 __io_alloc_req_refill fs/io_uring.c:1976 [inline] io_alloc_req_refill fs/io_uring.c:2002 [inline] io_submit_sqes.cold+0x20b/0x43d fs/io_uring.c:7314 __do_sys_io_uring_enter+0xf6e/0x1f50 fs/io_uring.c:10043 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 RIP: 0033:0x7fc91e9caae9 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:00007fc91bf40188 EFLAGS: 00000246 ORIG_RAX: 00000000000001aa RAX: ffffffffffffffda RBX: 00007fc91eaddf60 RCX: 00007fc91e9caae9 RDX: 0000000000000000 RSI: 00000000000068ac RDI: 0000000000000003 RBP: 00007fc91ea24f6d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc9d759eaf R14: 00007fc91bf40300 R15: 0000000000022000 ---------------- Code disassembly (best guess): 0: ed in (%dx),%eax 1: 26 be 76 65 8b 1d es mov $0x1d8b6576,%esi 7: 5e pop %rsi 8: 81 be 76 81 e3 ff ff cmpl $0x317fffff,-0x1c7e8a(%rsi) f: ff 7f 31 12: ff 89 de 0f 1f 44 decl 0x441f0fde(%rcx) 18: 00 00 add %al,(%rax) 1a: 85 db test %ebx,%ebx 1c: 74 11 je 0x2f 1e: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) 23: 44 89 e0 mov %r12d,%eax 26: 5b pop %rbx 27: 5d pop %rbp 28: 41 5c pop %r12 * 2a: 41 5d pop %r13 <-- trapping instruction 2c: 41 5e pop %r14 2e: c3 retq 2f: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) 34: 9c pushfq 35: 5b pop %rbx 36: 81 e3 00 02 00 00 and $0x200,%ebx 3c: 31 ff xor %edi,%edi 3e: 48 rex.W 3f: 89 .byte 0x89