======================================================== WARNING: possible irq lock inversion dependency detected 6.4.0-rc7-next-20230623 #1 Not tainted -------------------------------------------------------- syz-executor.7/5789 just changed the state of lock: ffffffff85815818 (blkg_stat_lock){+.-.}-{2:2}, at: __blkcg_rstat_flush.isra.0+0x11f/0x4e0 but this lock was taken by another, HARDIRQ-safe lock in the past: (per_cpu_ptr(&cgroup_rstat_cpu_lock, cpu)){-.-.}-{2:2} and interrupts could create inverse lock ordering between them. other info that might help us debug this: Possible interrupt unsafe locking scenario: CPU0 CPU1 ---- ---- lock(blkg_stat_lock); local_irq_disable(); lock(per_cpu_ptr(&cgroup_rstat_cpu_lock, cpu)); lock(blkg_stat_lock); lock(per_cpu_ptr(&cgroup_rstat_cpu_lock, cpu)); *** DEADLOCK *** 3 locks held by syz-executor.7/5789: #0: ffff88803d7361d0 (&client->ioctl_mutex){+.+.}-{3:3}, at: snd_seq_ioctl+0x1e4/0x3f0 #1: ffffffff8560b5a0 (rcu_callback){....}-{0:0}, at: rcu_core+0x83e/0x28b0 #2: ffffffff8560b6c0 (rcu_read_lock){....}-{1:2}, at: __blkcg_rstat_flush.isra.0+0x93/0x4e0 the shortest dependencies between 2nd lock and 1st lock: -> (per_cpu_ptr(&cgroup_rstat_cpu_lock, cpu)){-.-.}-{2:2} { IN-HARDIRQ-W at: lock_acquire+0x19a/0x4c0 _raw_spin_lock_irqsave+0x3a/0x60 cgroup_rstat_updated+0xcb/0x2e0 __cgroup_account_cputime_field+0xa0/0x120 account_system_index_time+0x199/0x2c0 update_process_times+0x26/0x150 tick_sched_handle+0x8e/0x170 tick_sched_timer+0xe6/0x110 __hrtimer_run_queues+0x17f/0xb60 hrtimer_interrupt+0x2ef/0x750 __sysvec_apic_timer_interrupt+0xff/0x380 sysvec_apic_timer_interrupt+0x69/0x90 asm_sysvec_apic_timer_interrupt+0x1a/0x20 __schedule+0x9c9/0x2b00 __cond_resched+0x46/0x70 __mutex_lock+0xa3/0x1a30 __flush_workqueue+0x137/0x1110 cgroup_procs_write_finish+0xeb/0x170 __cgroup_procs_write+0x371/0x6b0 cgroup_procs_write+0x26/0x60 cgroup_file_write+0x1e5/0x7c0 kernfs_fop_write_iter+0x3f7/0x610 vfs_write+0x97d/0xda0 ksys_write+0x122/0x250 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 IN-SOFTIRQ-W at: lock_acquire+0x19a/0x4c0 _raw_spin_lock_irqsave+0x3a/0x60 cgroup_rstat_updated+0xcb/0x2e0 __mod_memcg_lruvec_state+0x18d/0x2b0 mod_objcg_mlstate+0x119/0x230 drain_obj_stock+0x125/0x580 refill_obj_stock+0x12d/0x5c0 kmem_cache_free+0x444/0x4d0 rcu_core+0x8c8/0x28b0 __do_softirq+0x1b7/0x7d4 run_ksoftirqd+0x29/0x50 smpboot_thread_fn+0x40b/0x930 kthread+0x33f/0x440 ret_from_fork+0x2c/0x50 INITIAL USE at: lock_acquire+0x19a/0x4c0 _raw_spin_lock_irqsave+0x3a/0x60 cgroup_rstat_flush_locked+0x131/0xd80 cgroup_rstat_flush+0x37/0x50 do_flush_stats+0x97/0xf0 flush_memcg_stats_dwork+0x9/0x50 process_one_work+0xabf/0x1770 worker_thread+0x64f/0x12a0 kthread+0x33f/0x440 ret_from_fork+0x2c/0x50 } ... key at: [] __key.0+0x0/0x40 ... acquired at: _raw_spin_lock+0x2b/0x40 __blkcg_rstat_flush.isra.0+0x11f/0x4e0 blkcg_rstat_flush+0x87/0xb0 cgroup_rstat_flush_locked+0x706/0xd80 cgroup_rstat_flush+0x37/0x50 do_flush_stats+0x97/0xf0 mem_cgroup_wb_stats+0x3d8/0x4b0 balance_dirty_pages+0x339/0x2640 balance_dirty_pages_ratelimited_flags+0xbce/0x1130 fault_dirty_shared_page+0x2b3/0x500 do_wp_page+0x3c8/0x3b00 __handle_mm_fault+0xcbc/0x2d20 handle_mm_fault+0x1af/0xba0 do_user_addr_fault+0x58e/0x12f0 exc_page_fault+0x9c/0x1a0 asm_exc_page_fault+0x26/0x30 -> (blkg_stat_lock){+.-.}-{2:2} { HARDIRQ-ON-W at: lock_acquire+0x19a/0x4c0 _raw_spin_lock+0x2b/0x40 __blkcg_rstat_flush.isra.0+0x11f/0x4e0 __blkg_release+0xfa/0x3b0 rcu_core+0x8c8/0x28b0 __do_softirq+0x1b7/0x7d4 irq_exit_rcu+0x93/0xc0 sysvec_apic_timer_interrupt+0x6e/0x90 asm_sysvec_apic_timer_interrupt+0x1a/0x20 __schedule+0xa/0x2b00 __cond_resched+0x46/0x70 __kmem_cache_alloc_node+0x2b6/0x320 kmalloc_trace+0x26/0xc0 snd_seq_prioq_new+0x40/0x120 snd_seq_queue_alloc+0x133/0x510 snd_seq_ioctl_create_queue+0xa9/0x380 snd_seq_ioctl+0x212/0x3f0 __x64_sys_ioctl+0x1a4/0x210 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 IN-SOFTIRQ-W at: lock_acquire+0x19a/0x4c0 _raw_spin_lock+0x2b/0x40 __blkcg_rstat_flush.isra.0+0x11f/0x4e0 __blkg_release+0xfa/0x3b0 rcu_core+0x8c8/0x28b0 __do_softirq+0x1b7/0x7d4 irq_exit_rcu+0x93/0xc0 sysvec_apic_timer_interrupt+0x6e/0x90 asm_sysvec_apic_timer_interrupt+0x1a/0x20 __schedule+0xa/0x2b00 __cond_resched+0x46/0x70 __kmem_cache_alloc_node+0x2b6/0x320 kmalloc_trace+0x26/0xc0 snd_seq_prioq_new+0x40/0x120 snd_seq_queue_alloc+0x133/0x510 snd_seq_ioctl_create_queue+0xa9/0x380 snd_seq_ioctl+0x212/0x3f0 __x64_sys_ioctl+0x1a4/0x210 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 INITIAL USE at: lock_acquire+0x19a/0x4c0 _raw_spin_lock+0x2b/0x40 __blkcg_rstat_flush.isra.0+0x11f/0x4e0 blkcg_rstat_flush+0x87/0xb0 cgroup_rstat_flush_locked+0x706/0xd80 cgroup_rstat_flush+0x37/0x50 do_flush_stats+0x97/0xf0 mem_cgroup_wb_stats+0x3d8/0x4b0 balance_dirty_pages+0x339/0x2640 balance_dirty_pages_ratelimited_flags+0xbce/0x1130 fault_dirty_shared_page+0x2b3/0x500 do_wp_page+0x3c8/0x3b00 __handle_mm_fault+0xcbc/0x2d20 handle_mm_fault+0x1af/0xba0 do_user_addr_fault+0x58e/0x12f0 exc_page_fault+0x9c/0x1a0 asm_exc_page_fault+0x26/0x30 } ... key at: [] blkg_stat_lock+0x18/0x60 ... acquired at: __lock_acquire+0x8b8/0x6340 lock_acquire+0x19a/0x4c0 _raw_spin_lock+0x2b/0x40 __blkcg_rstat_flush.isra.0+0x11f/0x4e0 __blkg_release+0xfa/0x3b0 rcu_core+0x8c8/0x28b0 __do_softirq+0x1b7/0x7d4 irq_exit_rcu+0x93/0xc0 sysvec_apic_timer_interrupt+0x6e/0x90 asm_sysvec_apic_timer_interrupt+0x1a/0x20 __schedule+0xa/0x2b00 __cond_resched+0x46/0x70 __kmem_cache_alloc_node+0x2b6/0x320 kmalloc_trace+0x26/0xc0 snd_seq_prioq_new+0x40/0x120 snd_seq_queue_alloc+0x133/0x510 snd_seq_ioctl_create_queue+0xa9/0x380 snd_seq_ioctl+0x212/0x3f0 __x64_sys_ioctl+0x1a4/0x210 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 stack backtrace: CPU: 1 PID: 5789 Comm: syz-executor.7 Not tainted 6.4.0-rc7-next-20230623 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Call Trace: dump_stack_lvl+0x91/0xf0 print_irq_inversion_bug.part.0+0x3d5/0x570 mark_lock.part.0+0x900/0x2f50 __lock_acquire+0x8b8/0x6340 lock_acquire+0x19a/0x4c0 _raw_spin_lock+0x2b/0x40 __blkcg_rstat_flush.isra.0+0x11f/0x4e0 __blkg_release+0xfa/0x3b0 rcu_core+0x8c8/0x28b0 __do_softirq+0x1b7/0x7d4 irq_exit_rcu+0x93/0xc0 sysvec_apic_timer_interrupt+0x6e/0x90 asm_sysvec_apic_timer_interrupt+0x1a/0x20 RIP: 0010:__schedule+0xa/0x2b00 Code: fb 2d fd e9 68 ff ff ff 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 48 ba 00 00 00 00 00 fc ff df <55> 48 89 e5 41 57 41 56 48 8d 85 18 ff ff ff 41 55 48 c1 e8 03 41 loop6: detected capacity change from 0 to 736 RSP: 0018:ffff8880444afc30 EFLAGS: 00000202 RAX: dffffc0000000000 RBX: ffffed1002b226d0 RCX: 0000000000000001 RDX: dffffc0000000000 RSI: ffffffff8560b600 RDI: 0000000000000001 RBP: ffff888015913680 R08: 0000000000000000 R09: ffff888015914068 R10: ffffffff85d40917 R11: 0000000000000001 R12: ffff888008441780 R13: 0000000000000dc0 R14: ffff888018e0dc48 R15: 000000000000008c __cond_resched+0x46/0x70 __kmem_cache_alloc_node+0x2b6/0x320 kmalloc_trace+0x26/0xc0 snd_seq_prioq_new+0x40/0x120 snd_seq_queue_alloc+0x133/0x510 snd_seq_ioctl_create_queue+0xa9/0x380 snd_seq_ioctl+0x212/0x3f0 __x64_sys_ioctl+0x1a4/0x210 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 RIP: 0033:0x7fcea09acb19 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:00007fce9df22188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fcea0abff60 RCX: 00007fcea09acb19 RDX: 0000000020000100 RSI: 00000000c08c5332 RDI: 0000000000000007 RBP: 00007fcea0a06f6d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc6a4a3e9f R14: 00007fce9df22300 R15: 0000000000022000 ISO 9660 Extensions: RRIP_1991A 9pnet_fd: Insufficient options for proto=fd ---------------- Code disassembly (best guess), 2 bytes skipped: 0: fd std 1: e9 68 ff ff ff jmpq 0xffffff6e 6: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1) d: 00 e: 90 nop f: 90 nop 10: 90 nop 11: 90 nop 12: 90 nop 13: 90 nop 14: 90 nop 15: 90 nop 16: 90 nop 17: 90 nop 18: 90 nop 19: 90 nop 1a: 90 nop 1b: 90 nop 1c: 90 nop 1d: 90 nop 1e: 48 ba 00 00 00 00 00 movabs $0xdffffc0000000000,%rdx 25: fc ff df * 28: 55 push %rbp <-- trapping instruction 29: 48 89 e5 mov %rsp,%rbp 2c: 41 57 push %r15 2e: 41 56 push %r14 30: 48 8d 85 18 ff ff ff lea -0xe8(%rbp),%rax 37: 41 55 push %r13 39: 48 c1 e8 03 shr $0x3,%rax 3d: 41 rex.B