======================================================== WARNING: possible irq lock inversion dependency detected 6.4.0-rc7-next-20230623 #1 Not tainted -------------------------------------------------------- syz-fuzzer/243 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 *** 2 locks held by syz-fuzzer/243: #0: ffffffff8560b5a0 (rcu_callback){....}-{0:0}, at: rcu_core+0x83e/0x28b0 #1: 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 __virt_addr_valid+0x175/0x340 kasan_addr_to_slab+0xd/0xa0 __kasan_record_aux_stack+0xe/0xa0 __call_rcu_common.constprop.0+0x6a/0xbd0 __kmem_cache_free+0x95/0x330 kernfs_fop_write_iter+0x200/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 __cgroup_account_cputime+0x75/0xc0 update_curr+0x350/0x6d0 dequeue_task_fair+0x20e/0x14a0 load_balance+0xcb4/0x2790 rebalance_domains+0x66c/0xc00 __do_softirq+0x1b7/0x7d4 irq_exit_rcu+0x93/0xc0 sysvec_apic_timer_interrupt+0x6e/0x90 asm_sysvec_apic_timer_interrupt+0x1a/0x20 __sanitizer_cov_trace_pc+0x11/0x70 is_module_text_address+0x14/0x1d0 kernel_text_address+0x35/0xc0 __kernel_text_address+0xd/0x40 unwind_get_return_address+0x59/0xa0 arch_stack_walk+0x9d/0xf0 stack_trace_save+0x90/0xd0 kasan_save_stack+0x22/0x50 __kasan_record_aux_stack+0x8e/0xa0 __call_rcu_common.constprop.0+0x6a/0xbd0 kmem_cache_free+0xc1/0x4d0 putname+0x102/0x140 user_path_at_empty+0x51/0x70 do_faccessat+0x127/0xae0 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 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 flush_memcg_stats_dwork+0x9/0x50 process_one_work+0xabf/0x1770 worker_thread+0x64f/0x12a0 kthread+0x33f/0x440 ret_from_fork+0x2c/0x50 -> (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 finish_task_switch.isra.0+0x20d/0x830 __schedule+0x9b1/0x2b00 schedule+0xdb/0x1a0 exit_to_user_mode_prepare+0x95/0x180 irqentry_exit_to_user_mode+0x9/0x30 asm_sysvec_apic_timer_interrupt+0x1a/0x20 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 finish_task_switch.isra.0+0x20d/0x830 __schedule+0x9b1/0x2b00 schedule+0xdb/0x1a0 exit_to_user_mode_prepare+0x95/0x180 irqentry_exit_to_user_mode+0x9/0x30 asm_sysvec_apic_timer_interrupt+0x1a/0x20 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 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: [] 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 finish_task_switch.isra.0+0x20d/0x830 __schedule+0x9b1/0x2b00 schedule+0xdb/0x1a0 exit_to_user_mode_prepare+0x95/0x180 irqentry_exit_to_user_mode+0x9/0x30 asm_sysvec_apic_timer_interrupt+0x1a/0x20 stack backtrace: CPU: 1 PID: 243 Comm: syz-fuzzer 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:finish_task_switch.isra.0+0x20d/0x830 Code: 89 ff 48 c7 03 00 00 00 00 e8 bf a6 31 03 4d 85 e4 75 ba 4c 89 ff e8 92 81 31 03 e8 dd 37 30 00 fb 65 48 8b 1c 25 c0 8a 03 00 <48> 8d bb 78 14 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 RSP: 0018:ffff888015977d78 EFLAGS: 00000206 RAX: 00000000000d68e1 RBX: ffff888015a13680 RCX: 1ffffffff0ba7be9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff812363f3 RBP: ffff888015977db8 R08: 0000000000000001 R09: 0000000000000001 R10: ffffffff85d40917 R11: 0000000000000001 R12: ffff88806cf39518 R13: ffff88800fbad1c0 R14: ffff8880169684a8 R15: ffff88806cf39500 __schedule+0x9b1/0x2b00 schedule+0xdb/0x1a0 exit_to_user_mode_prepare+0x95/0x180 irqentry_exit_to_user_mode+0x9/0x30 asm_sysvec_apic_timer_interrupt+0x1a/0x20 RIP: 0033:0x410719 Code: 04 0f 85 44 01 00 00 80 78 09 00 0f 85 8c 00 00 00 48 8b 40 10 eb 5d 48 ff c2 48 83 c1 04 48 83 fa 08 73 3a 8b 5c 24 38 39 19 <75> eb 0f b6 1c 02 80 fb 01 76 e2 48 8b 4c 24 28 0f b6 49 51 48 0f RSP: 002b:000000c004b8f7b8 EFLAGS: 00000246 RAX: 000000c002223d70 RBX: 00000000accd4cd4 RCX: 000000c002223d78 RDX: 0000000000000000 RSI: 0000000000957680 RDI: 0000000000000038 RBP: 000000c004b8f7d0 R08: 0000000000000000 R09: 0000000000203001 R10: 0000000000000002 R11: 0000000000000011 R12: 00000000000000f1 R13: 0000000000000000 R14: 0000000000e5dacd R15: 0000000000000000 loop5: detected capacity change from 0 to 256 loop5: detected capacity change from 0 to 256 ---------------- Code disassembly (best guess): 0: 89 ff mov %edi,%edi 2: 48 c7 03 00 00 00 00 movq $0x0,(%rbx) 9: e8 bf a6 31 03 callq 0x331a6cd e: 4d 85 e4 test %r12,%r12 11: 75 ba jne 0xffffffcd 13: 4c 89 ff mov %r15,%rdi 16: e8 92 81 31 03 callq 0x33181ad 1b: e8 dd 37 30 00 callq 0x3037fd 20: fb sti 21: 65 48 8b 1c 25 c0 8a mov %gs:0x38ac0,%rbx 28: 03 00 * 2a: 48 8d bb 78 14 00 00 lea 0x1478(%rbx),%rdi <-- trapping instruction 31: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax 38: fc ff df 3b: 48 89 fa mov %rdi,%rdx 3e: 48 rex.W 3f: c1 .byte 0xc1