======================================================== WARNING: possible irq lock inversion dependency detected 6.4.0-rc7-next-20230621 #1 Not tainted -------------------------------------------------------- syz-executor.5/7507 just changed the state of lock: ffffffff85814e18 (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)); SELinux: unrecognized netlink message: protocol=0 nlmsg_type=0 sclass=netlink_route_socket pid=7525 comm=syz-executor.0 lock(blkg_stat_lock); lock(per_cpu_ptr(&cgroup_rstat_cpu_lock, cpu)); *** DEADLOCK *** 2 locks held by syz-executor.5/7507: #0: ffffffff8560b520 (rcu_callback){....}-{0:0}, at: rcu_core+0x83e/0x2860 #1: ffffffff8560b640 (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 lock_acquire+0x1c7/0x4c0 fs_reclaim_acquire+0x121/0x170 __kmem_cache_alloc_node+0x4c/0x320 __kmalloc_node+0x4d/0x160 kvmalloc_node+0xaa/0x200 seq_read_iter+0x820/0x1300 kernfs_fop_read_iter+0x4d4/0x690 vfs_read+0x4b5/0x8f0 ksys_read+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 enqueue_task_fair+0x6a9/0x1ca0 activate_task+0xe7/0x250 ttwu_do_activate+0x10d/0x7a0 sched_ttwu_pending+0x1da/0x3b0 __flush_smp_call_function_queue+0x594/0xea0 __sysvec_call_function_single+0x96/0x2a0 sysvec_call_function_single+0x33/0x90 asm_sysvec_call_function_single+0x1a/0x20 unwind_next_frame+0x49e/0x2490 arch_stack_walk+0x87/0xf0 stack_trace_save+0x90/0xd0 kasan_save_stack+0x22/0x50 kasan_set_track+0x25/0x30 kasan_save_free_info+0x2b/0x50 __kasan_slab_free+0x10a/0x190 kmem_cache_free+0x10d/0x4d0 rcu_core+0x8c8/0x2860 __do_softirq+0x1b7/0x7d4 irq_exit_rcu+0x93/0xc0 sysvec_apic_timer_interrupt+0x6e/0x90 asm_sysvec_apic_timer_interrupt+0x1a/0x20 unwind_next_frame+0xcbd/0x2490 arch_stack_walk+0x87/0xf0 stack_trace_save+0x90/0xd0 kasan_save_stack+0x22/0x50 __kasan_record_aux_stack+0x8e/0xa0 __call_rcu_common.constprop.0+0x6a/0xb90 kmem_cache_free_bulk.part.0+0x31c/0x680 mas_destroy+0x1db/0x8b0 mas_store_prealloc+0xf4/0x160 vma_complete+0xa71/0xfc0 __split_vma+0x65e/0x770 do_vmi_align_munmap+0x3ef/0x12e0 do_vmi_munmap+0x1f1/0x2b0 mmap_region+0x1fe/0x26c0 do_mmap+0x854/0xf00 vm_mmap_pgoff+0x1a6/0x3a0 ksys_mmap_pgoff+0x3af/0x500 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/0x2860 __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 do_nanosleep+0x154/0x510 hrtimer_nanosleep+0x208/0x590 common_nsleep+0xaa/0xd0 __x64_sys_clock_nanosleep+0x335/0x480 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/0x2860 __do_softirq+0x1b7/0x7d4 irq_exit_rcu+0x93/0xc0 netlink: 8 bytes leftover after parsing attributes in process `syz-executor.7'. sysvec_apic_timer_interrupt+0x6e/0x90 asm_sysvec_apic_timer_interrupt+0x1a/0x20 syz-executor.4: attempt to access beyond end of device loop4: rw=2049, sector=40, nr_sectors = 4 limit=40 finish_task_switch.isra.0+0x20d/0x830 __schedule+0x9b1/0x2b00 Buffer I/O error on dev loop4, logical block 10, lost async page write schedule+0xdb/0x1a0 do_nanosleep+0x154/0x510 hrtimer_nanosleep+0x208/0x590 netlink: 8 bytes leftover after parsing attributes in process `syz-executor.7'. common_nsleep+0xaa/0xd0 __x64_sys_clock_nanosleep+0x335/0x480 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 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/0x2860 __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 do_nanosleep+0x154/0x510 hrtimer_nanosleep+0x208/0x590 common_nsleep+0xaa/0xd0 __x64_sys_clock_nanosleep+0x335/0x480 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 stack backtrace: CPU: 0 PID: 7507 Comm: syz-executor.5 Not tainted 6.4.0-rc7-next-20230621 #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/0x2860 __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 9f 6b 30 03 4d 85 e4 75 ba 4c 89 ff e8 62 46 30 03 e8 fd 21 30 00 fb 65 48 8b 1c 25 00 8b 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:ffff888016c9fad0 EFLAGS: 00000202 RAX: 0000000000000acd RBX: ffff888041689b40 RCX: 1ffffffff0ba7721 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff81234093 RBP: ffff888016c9fb10 R08: 0000000000000001 R09: 0000000000000001 R10: ffffffff85d3e2d7 R11: 0000000000000001 R12: ffff88806ce39518 R13: ffff888017631b40 R14: ffff88801f373b28 R15: ffff88806ce39500 __schedule+0x9b1/0x2b00 schedule+0xdb/0x1a0 do_nanosleep+0x154/0x510 hrtimer_nanosleep+0x208/0x590 common_nsleep+0xaa/0xd0 __x64_sys_clock_nanosleep+0x335/0x480 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 RIP: 0033:0x7f5cd0ff68e1 Code: 24 0c 89 3c 24 48 89 4c 24 18 e8 aa e7 ff ff 4c 8b 54 24 18 48 8b 54 24 10 41 89 c0 8b 74 24 0c 8b 3c 24 b8 e6 00 00 00 0f 05 <44> 89 c7 48 89 04 24 e8 e3 e7 ff ff 48 8b 04 24 eb 97 66 2e 0f 1f RSP: 002b:00007fffe91d4450 EFLAGS: 00000293 ORIG_RAX: 00000000000000e6 RAX: ffffffffffffffda RBX: 000000000004f858 RCX: 00007f5cd0ff68e1 RDX: 00007fffe91d4490 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000001 R08: 0000000000000000 R09: 00007fffe91f4080 R10: 0000000000000000 R11: 0000000000000293 R12: 00007f5cd10e4f60 R13: 00007f5cd10e5b60 R14: 00007f5cd10e4f60 R15: 000000000004f517 loop3: detected capacity change from 0 to 512 loop4: detected capacity change from 0 to 40 loop3: detected capacity change from 0 to 512 EXT4-fs (loop3): mounted filesystem 00000000-0000-0000-0000-000000000000 r/w without journal. Quota mode: none. EXT4-fs (loop3): unmounting filesystem 00000000-0000-0000-0000-000000000000. syz-executor.4: attempt to access beyond end of device loop4: rw=2049, sector=40, nr_sectors = 4 limit=40 Buffer I/O error on dev loop4, logical block 10, lost async page write ---------------- Code disassembly (best guess): 0: 89 ff mov %edi,%edi 2: 48 c7 03 00 00 00 00 movq $0x0,(%rbx) 9: e8 9f 6b 30 03 callq 0x3306bad e: 4d 85 e4 test %r12,%r12 11: 75 ba jne 0xffffffcd 13: 4c 89 ff mov %r15,%rdi 16: e8 62 46 30 03 callq 0x330467d 1b: e8 fd 21 30 00 callq 0x30221d 20: fb sti 21: 65 48 8b 1c 25 00 8b mov %gs:0x38b00,%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