======================================================== WARNING: possible irq lock inversion dependency detected 6.4.0-rc7-next-20230622 #1 Not tainted -------------------------------------------------------- syz-executor.0/5587 just changed the state of lock: ffffffff85814c18 (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 *** 4 locks held by syz-executor.0/5587: #0: ffff88800f5f26a0 (&mm->mmap_lock){++++}-{3:3}, at: exit_mmap+0xf6/0x8d0 #1: ffff88800f0a5258 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: __pte_offset_map_lock+0x121/0x290 #2: ffffffff8560b5a0 (rcu_callback){....}-{0:0}, at: rcu_core+0x83e/0x2860 #3: 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 _raw_spin_unlock_irqrestore+0x34/0x50 kmemleak_free+0x18a/0x200 __kmem_cache_free+0x95/0x330 kernfs_release_file+0xf7/0x240 kernfs_fop_release+0x193/0x1e0 __fput+0x406/0xad0 task_work_run+0x174/0x280 exit_to_user_mode_prepare+0x17d/0x180 syscall_exit_to_user_mode+0x1d/0x50 do_syscall_64+0x4c/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 kasan_save_free_info+0xb/0x50 __kasan_slab_free+0x10a/0x190 kmem_cache_free_bulk.part.0+0x225/0x680 mas_destroy+0x1db/0x8b0 mas_store_prealloc+0xf4/0x160 mmap_region+0x1229/0x26c0 do_mmap+0x833/0xea0 vm_mmap_pgoff+0x1a8/0x3b0 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 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/0x2bf0 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/0x2860 __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+0x20/0x70 vm_normal_page+0x134/0x2e0 unmap_page_range+0xa98/0x2860 unmap_single_vma+0x19a/0x2b0 unmap_vmas+0x233/0x390 exit_mmap+0x16a/0x8d0 mmput+0xd5/0x390 do_exit+0x99f/0x2780 do_group_exit+0xd4/0x2a0 get_signal+0x263f/0x26c0 arch_do_signal_or_restart+0x79/0x590 exit_to_user_mode_prepare+0xeb/0x180 syscall_exit_to_user_mode+0x1d/0x50 do_syscall_64+0x4c/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 sysvec_apic_timer_interrupt+0x6e/0x90 asm_sysvec_apic_timer_interrupt+0x1a/0x20 __sanitizer_cov_trace_pc+0x20/0x70 vm_normal_page+0x134/0x2e0 unmap_page_range+0xa98/0x2860 unmap_single_vma+0x19a/0x2b0 unmap_vmas+0x233/0x390 exit_mmap+0x16a/0x8d0 mmput+0xd5/0x390 do_exit+0x99f/0x2780 do_group_exit+0xd4/0x2a0 get_signal+0x263f/0x26c0 arch_do_signal_or_restart+0x79/0x590 exit_to_user_mode_prepare+0xeb/0x180 syscall_exit_to_user_mode+0x1d/0x50 do_syscall_64+0x4c/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/0x2bf0 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/0x2860 __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+0x20/0x70 vm_normal_page+0x134/0x2e0 unmap_page_range+0xa98/0x2860 unmap_single_vma+0x19a/0x2b0 unmap_vmas+0x233/0x390 exit_mmap+0x16a/0x8d0 mmput+0xd5/0x390 do_exit+0x99f/0x2780 do_group_exit+0xd4/0x2a0 get_signal+0x263f/0x26c0 arch_do_signal_or_restart+0x79/0x590 exit_to_user_mode_prepare+0xeb/0x180 syscall_exit_to_user_mode+0x1d/0x50 do_syscall_64+0x4c/0x90 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 stack backtrace: CPU: 1 PID: 5587 Comm: syz-executor.0 Not tainted 6.4.0-rc7-next-20230622 #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:__sanitizer_cov_trace_pc+0x20/0x70 Code: 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 65 8b 05 8d 54 b7 7e 89 c1 48 8b 34 24 81 e1 00 01 00 00 65 48 8b 14 25 c0 8a 03 00 00 01 ff 00 74 0e 85 c9 74 35 8b 82 9c 14 00 00 85 c0 74 2b 8b RSP: 0018:ffff8880090bf638 EFLAGS: 00000246 RAX: 0000000080000001 RBX: 000000000003a4f1 RCX: 0000000000000000 RDX: ffff8880422fd1c0 RSI: ffffffff8170c744 RDI: 0000000000000006 RBP: 1ffff11001217ec9 R08: 0000000000000006 R09: 000000000003a4f1 R10: 000000000007ffdf R11: 0000000000000001 R12: ffff88800d7ec828 R13: 00007f117a471000 R14: 000000000007ffdf R15: 0000000000000000 vm_normal_page+0x134/0x2e0 unmap_page_range+0xa98/0x2860 unmap_single_vma+0x19a/0x2b0 unmap_vmas+0x233/0x390 exit_mmap+0x16a/0x8d0 mmput+0xd5/0x390 do_exit+0x99f/0x2780 do_group_exit+0xd4/0x2a0 get_signal+0x263f/0x26c0 arch_do_signal_or_restart+0x79/0x590 exit_to_user_mode_prepare+0xeb/0x180 syscall_exit_to_user_mode+0x1d/0x50 do_syscall_64+0x4c/0x90 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 RIP: 0033:0x7f117b4bcb19 Code: Unable to access opcode bytes at 0x7f117b4bcaef. RSP: 002b:00007f11789f0188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: 0000000000000000 RBX: 00007f117b5d00e0 RCX: 00007f117b4bcb19 RDX: 0000000000000001 RSI: 0000000000004c81 RDI: 0000000000000008 RBP: 00007f117b516f6d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffcdc3387ef R14: 00007f11789f0300 R15: 0000000000022000 syz-executor.1 (5570) used greatest stack depth: 23032 bytes left FAULT_INJECTION: forcing a failure. name fail_usercopy, interval 1, probability 0, space 0, times 0 CPU: 0 PID: 5597 Comm: syz-executor.2 Not tainted 6.4.0-rc7-next-20230622 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Call Trace: dump_stack_lvl+0xc1/0xf0 should_fail_ex+0x4b4/0x5b0 _copy_to_user+0x30/0xc0 simple_read_from_buffer+0xd0/0x170 proc_fail_nth_read+0x1a2/0x240 vfs_read+0x1de/0x8f0 ksys_read+0x122/0x250 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 RIP: 0033:0x7f4da781769c Code: ec 28 48 89 54 24 18 48 89 74 24 10 89 7c 24 08 e8 f9 fc ff ff 48 8b 54 24 18 48 8b 74 24 10 41 89 c0 8b 7c 24 08 31 c0 0f 05 <48> 3d 00 f0 ff ff 77 34 44 89 c7 48 89 44 24 08 e8 2f fd ff ff 48 RSP: 002b:00007f4da4dda170 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007f4da781769c RDX: 000000000000000f RSI: 00007f4da4dda1e0 RDI: 0000000000000004 RBP: 00007f4da4dda1d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007ffdc3275c8f R14: 00007f4da4dda300 R15: 0000000000022000 ---------------- Code disassembly (best guess): 0: 90 nop 1: 90 nop 2: 90 nop 3: 90 nop 4: 90 nop 5: 90 nop 6: 90 nop 7: 90 nop 8: 90 nop 9: 90 nop a: f3 0f 1e fa endbr64 e: 65 8b 05 8d 54 b7 7e mov %gs:0x7eb7548d(%rip),%eax # 0x7eb754a2 15: 89 c1 mov %eax,%ecx 17: 48 8b 34 24 mov (%rsp),%rsi 1b: 81 e1 00 01 00 00 and $0x100,%ecx 21: 65 48 8b 14 25 c0 8a mov %gs:0x38ac0,%rdx 28: 03 00 * 2a: a9 00 01 ff 00 test $0xff0100,%eax <-- trapping instruction 2f: 74 0e je 0x3f 31: 85 c9 test %ecx,%ecx 33: 74 35 je 0x6a 35: 8b 82 9c 14 00 00 mov 0x149c(%rdx),%eax 3b: 85 c0 test %eax,%eax 3d: 74 2b je 0x6a 3f: 8b .byte 0x8b