======================================================== WARNING: possible irq lock inversion dependency detected 6.4.0-rc7-next-20230623 #1 Not tainted -------------------------------------------------------- syz-executor.7/4003 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 *** 4 locks held by syz-executor.7/4003: #0: ffff88801001e760 (&mm->mmap_lock){++++}-{3:3}, at: exit_mmap+0xf6/0x8d0 #1: ffff88800e86af78 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: __pte_offset_map_lock+0x121/0x290 #2: ffffffff8560b5a0 (rcu_callback){....}-{0:0}, at: rcu_core+0x83e/0x28b0 #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 unwind_next_frame+0x10a/0x2490 arch_stack_walk+0x87/0xf0 stack_trace_save+0x90/0xd0 kasan_save_stack+0x22/0x50 __kasan_record_aux_stack+0x8e/0xa0 kvfree_call_rcu+0x29/0x900 kernfs_unlink_open_file+0x334/0x3d0 kernfs_fop_release+0xeb/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 enqueue_task_fair+0x6a9/0x1ca0 activate_task+0xe7/0x250 ttwu_do_activate+0x10d/0x7a0 try_to_wake_up+0x627/0x1b30 wake_bit_function+0xfe/0x240 __wake_up_common+0x14c/0x4c0 __wake_up_common_lock+0xd7/0x140 wake_up_bit+0xdd/0x130 end_buffer_read_sync+0x85/0xe0 end_bio_bh_io_sync+0xde/0x130 bio_endio+0x51a/0x620 blk_update_request+0x397/0x12a0 scsi_end_request+0x7a/0xa20 scsi_io_completion+0xc0/0x1640 scsi_complete+0x114/0x380 blk_complete_reqs+0xb8/0xf0 __do_softirq+0x1b7/0x7d4 irq_exit_rcu+0x93/0xc0 sysvec_call_function_single+0x6e/0x90 asm_sysvec_call_function_single+0x1a/0x20 __sanitizer_cov_trace_pc+0xb/0x70 do_user_addr_fault+0x4f8/0x12f0 exc_page_fault+0x9c/0x1a0 asm_exc_page_fault+0x26/0x30 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 write_comp_data+0x3c/0x90 unmap_page_range+0xe7a/0x2860 unmap_single_vma+0x19a/0x2b0 unmap_vmas+0x233/0x390 exit_mmap+0x16a/0x8d0 mmput+0xd5/0x390 do_exit+0x99f/0x2740 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/0x28b0 __do_softirq+0x1b7/0x7d4 irq_exit_rcu+0x93/0xc0 sysvec_apic_timer_interrupt+0x6e/0x90 asm_sysvec_apic_timer_interrupt+0x1a/0x20 write_comp_data+0x3c/0x90 unmap_page_range+0xe7a/0x2860 unmap_single_vma+0x19a/0x2b0 unmap_vmas+0x233/0x390 exit_mmap+0x16a/0x8d0 mmput+0xd5/0x390 do_exit+0x99f/0x2740 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 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 write_comp_data+0x3c/0x90 unmap_page_range+0xe7a/0x2860 unmap_single_vma+0x19a/0x2b0 unmap_vmas+0x233/0x390 exit_mmap+0x16a/0x8d0 mmput+0xd5/0x390 do_exit+0x99f/0x2740 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: 4003 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:write_comp_data+0x3c/0x90 Code: 81 e6 00 01 00 00 65 48 8b 14 25 c0 8a 03 00 a9 00 01 ff 00 74 0e 85 f6 74 59 8b 82 9c 14 00 00 85 c0 74 4f 8b 82 78 14 00 00 <83> f8 03 75 44 48 8b 82 80 14 00 00 8b 92 7c 14 00 00 48 8b 38 48 RSP: 0018:ffff8880193a76d8 EFLAGS: 00000246 RAX: 0000000000000000 RBX: ffffea0000d2c1c0 RCX: ffffffff817123ba RDX: ffff8880159dd1c0 RSI: 0000000000000000 RDI: 0000000000000001 RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000 R13: 00007feaa7f87000 R14: ffff888041df4c30 R15: dffffc0000000000 unmap_page_range+0xe7a/0x2860 unmap_single_vma+0x19a/0x2b0 unmap_vmas+0x233/0x390 exit_mmap+0x16a/0x8d0 mmput+0xd5/0x390 do_exit+0x99f/0x2740 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:0x7feaa892fb19 Code: Unable to access opcode bytes at 0x7feaa892faef. RSP: 002b:00007feaa5e84188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: 0000000000000000 RBX: 00007feaa8a43020 RCX: 00007feaa892fb19 RDX: 0000000000000001 RSI: 0000000000004c81 RDI: 0000000000000004 RBP: 00007feaa8989f6d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fff0373927f R14: 00007feaa5e84300 R15: 0000000000022000 EXT4-fs (loop4): unmounting filesystem 00000000-0000-0000-0000-000000000000. loop3: detected capacity change from 0 to 240 loop3: detected capacity change from 0 to 240 program syz-executor.4 is using a deprecated SCSI ioctl, please convert it to SG_IO program syz-executor.4 is using a deprecated SCSI ioctl, please convert it to SG_IO loop3: detected capacity change from 0 to 40 ---------------- Code disassembly (best guess): 0: 81 e6 00 01 00 00 and $0x100,%esi 6: 65 48 8b 14 25 c0 8a mov %gs:0x38ac0,%rdx d: 03 00 f: a9 00 01 ff 00 test $0xff0100,%eax 14: 74 0e je 0x24 16: 85 f6 test %esi,%esi 18: 74 59 je 0x73 1a: 8b 82 9c 14 00 00 mov 0x149c(%rdx),%eax 20: 85 c0 test %eax,%eax 22: 74 4f je 0x73 24: 8b 82 78 14 00 00 mov 0x1478(%rdx),%eax * 2a: 83 f8 03 cmp $0x3,%eax <-- trapping instruction 2d: 75 44 jne 0x73 2f: 48 8b 82 80 14 00 00 mov 0x1480(%rdx),%rax 36: 8b 92 7c 14 00 00 mov 0x147c(%rdx),%edx 3c: 48 8b 38 mov (%rax),%rdi 3f: 48 rex.W