======================================================== WARNING: possible irq lock inversion dependency detected 6.4.0-rc7-next-20230621 #1 Not tainted -------------------------------------------------------- kworker/u4:3/47 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)); lock(blkg_stat_lock); lock(per_cpu_ptr(&cgroup_rstat_cpu_lock, cpu)); *** DEADLOCK *** 6 locks held by kworker/u4:3/47: #0: ffff888008783938 ((wq_completion)netns){+.+.}-{0:0}, at: process_one_work+0x99d/0x1770 #1: ffff88800f447db0 (net_cleanup_work){+.+.}-{0:0}, at: process_one_work+0x9d0/0x1770 #2: ffffffff85b6c250 (pernet_ops_rwsem){++++}-{3:3}, at: cleanup_net+0x9f/0x9f0 #3: ffffffff85b77928 (rtnl_mutex){+.+.}-{3:3}, at: default_device_exit_batch+0x92/0x5c0 #4: ffffffff8560b520 (rcu_callback){....}-{0:0}, at: rcu_core+0x83e/0x2860 #5: 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 __flush_workqueue+0x10d/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 loop7: detected capacity change from 0 to 264192 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_state+0x86/0x160 memcg_account_kmem+0x38/0x70 refill_obj_stock+0x35f/0x5c0 kmem_cache_free+0x444/0x4d0 vm_area_free_rcu_cb+0x95/0xe0 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_const_cmp8+0x8/0x20 in_gate_area_no_mm+0x42/0x80 core_kernel_text+0x24/0xa0 kernel_text_address+0x11/0xc0 __kernel_text_address+0xd/0x40 unwind_get_return_address+0x59/0xa0 arch_stack_walk+0x9d/0xf0 stack_trace_save+0x90/0xd0 set_track_prepare+0x74/0xd0 __create_object+0x3b2/0xc90 kmem_cache_alloc+0x20b/0x370 vm_area_alloc+0x20/0x200 mmap_region+0x430/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 mem_cgroup_wb_stats+0x3d8/0x4b0 wb_over_bg_thresh+0x30e/0x6a0 wb_workfn+0x486/0xed0 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 unwind_next_frame+0xbf7/0x2490 arch_stack_walk+0x87/0xf0 stack_trace_save+0x90/0xd0 kasan_save_stack+0x22/0x50 kasan_set_track+0x25/0x30 __kasan_slab_alloc+0x59/0x70 kmem_cache_alloc_node+0x198/0x3b0 kmalloc_reserve+0x169/0x270 __alloc_skb+0x129/0x330 inet6_netconf_notify_devconf+0x88/0x1b0 addrconf_sysctl_unregister+0x131/0x1c0 addrconf_ifdown.isra.0+0x137a/0x1780 addrconf_notify+0x105/0x19a0 notifier_call_chain+0xbb/0x310 call_netdevice_notifiers_info+0xb9/0x130 unregister_netdevice_many_notify+0x674/0x1500 default_device_exit_batch+0x453/0x5c0 ops_exit_list+0x12b/0x180 cleanup_net+0x488/0x9f0 process_one_work+0xabf/0x1770 worker_thread+0x64f/0x12a0 kthread+0x33f/0x440 ret_from_fork+0x2c/0x50 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 unwind_next_frame+0xbf7/0x2490 arch_stack_walk+0x87/0xf0 stack_trace_save+0x90/0xd0 kasan_save_stack+0x22/0x50 kasan_set_track+0x25/0x30 __kasan_slab_alloc+0x59/0x70 kmem_cache_alloc_node+0x198/0x3b0 kmalloc_reserve+0x169/0x270 __alloc_skb+0x129/0x330 inet6_netconf_notify_devconf+0x88/0x1b0 addrconf_sysctl_unregister+0x131/0x1c0 addrconf_ifdown.isra.0+0x137a/0x1780 addrconf_notify+0x105/0x19a0 notifier_call_chain+0xbb/0x310 call_netdevice_notifiers_info+0xb9/0x130 unregister_netdevice_many_notify+0x674/0x1500 default_device_exit_batch+0x453/0x5c0 ops_exit_list+0x12b/0x180 cleanup_net+0x488/0x9f0 process_one_work+0xabf/0x1770 worker_thread+0x64f/0x12a0 kthread+0x33f/0x440 ret_from_fork+0x2c/0x50 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 wb_over_bg_thresh+0x30e/0x6a0 wb_workfn+0x486/0xed0 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 unwind_next_frame+0xbf7/0x2490 arch_stack_walk+0x87/0xf0 stack_trace_save+0x90/0xd0 kasan_save_stack+0x22/0x50 kasan_set_track+0x25/0x30 __kasan_slab_alloc+0x59/0x70 kmem_cache_alloc_node+0x198/0x3b0 kmalloc_reserve+0x169/0x270 __alloc_skb+0x129/0x330 inet6_netconf_notify_devconf+0x88/0x1b0 addrconf_sysctl_unregister+0x131/0x1c0 addrconf_ifdown.isra.0+0x137a/0x1780 addrconf_notify+0x105/0x19a0 notifier_call_chain+0xbb/0x310 call_netdevice_notifiers_info+0xb9/0x130 unregister_netdevice_many_notify+0x674/0x1500 default_device_exit_batch+0x453/0x5c0 ops_exit_list+0x12b/0x180 cleanup_net+0x488/0x9f0 process_one_work+0xabf/0x1770 worker_thread+0x64f/0x12a0 kthread+0x33f/0x440 ret_from_fork+0x2c/0x50 stack backtrace: CPU: 1 PID: 47 Comm: kworker/u4:3 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 Workqueue: netns cleanup_net 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:unwind_next_frame+0xbf7/0x2490 Code: 04 01 e8 8c 68 1d 00 4c 8b 4c 24 08 e9 22 f7 ff ff 48 be 00 00 00 00 00 fc ff df 48 8d 79 02 48 89 f8 48 c1 e8 03 0f b6 14 30 <48> 8d 41 03 49 89 c0 49 c1 e8 03 41 0f b6 34 30 49 89 f8 41 83 e0 RSP: 0018:ffff88800f447278 EFLAGS: 00000212 RAX: 1ffffffff0c27386 RBX: 0000000000000001 RCX: ffffffff86139c2e RDX: 0000000000000000 RSI: dffffc0000000000 RDI: ffffffff86139c30 RBP: ffff88800f447340 R08: ffffffff86139c32 R09: ffff88800f447328 R10: 0000000000038001 R11: 0000000000020cb1 R12: ffff88800f447348 R13: ffff88800f447330 R14: ffff88800f4476d0 R15: ffff88800f4472e8 arch_stack_walk+0x87/0xf0 stack_trace_save+0x90/0xd0 kasan_save_stack+0x22/0x50 kasan_set_track+0x25/0x30 __kasan_slab_alloc+0x59/0x70 kmem_cache_alloc_node+0x198/0x3b0 kmalloc_reserve+0x169/0x270 __alloc_skb+0x129/0x330 inet6_netconf_notify_devconf+0x88/0x1b0 addrconf_sysctl_unregister+0x131/0x1c0 addrconf_ifdown.isra.0+0x137a/0x1780 addrconf_notify+0x105/0x19a0 notifier_call_chain+0xbb/0x310 call_netdevice_notifiers_info+0xb9/0x130 unregister_netdevice_many_notify+0x674/0x1500 default_device_exit_batch+0x453/0x5c0 ops_exit_list+0x12b/0x180 cleanup_net+0x488/0x9f0 process_one_work+0xabf/0x1770 worker_thread+0x64f/0x12a0 kthread+0x33f/0x440 ret_from_fork+0x2c/0x50 netlink: 'syz-executor.2': attribute type 27 has an invalid length. loop7: detected capacity change from 0 to 264192 ---------------- Code disassembly (best guess): 0: 04 01 add $0x1,%al 2: e8 8c 68 1d 00 callq 0x1d6893 7: 4c 8b 4c 24 08 mov 0x8(%rsp),%r9 c: e9 22 f7 ff ff jmpq 0xfffff733 11: 48 be 00 00 00 00 00 movabs $0xdffffc0000000000,%rsi 18: fc ff df 1b: 48 8d 79 02 lea 0x2(%rcx),%rdi 1f: 48 89 f8 mov %rdi,%rax 22: 48 c1 e8 03 shr $0x3,%rax 26: 0f b6 14 30 movzbl (%rax,%rsi,1),%edx * 2a: 48 8d 41 03 lea 0x3(%rcx),%rax <-- trapping instruction 2e: 49 89 c0 mov %rax,%r8 31: 49 c1 e8 03 shr $0x3,%r8 35: 41 0f b6 34 30 movzbl (%r8,%rsi,1),%esi 3a: 49 89 f8 mov %rdi,%r8 3d: 41 rex.B 3e: 83 .byte 0x83 3f: e0 .byte 0xe0