================================ WARNING: inconsistent lock state 6.4.0-syzkaller #0 Not tainted -------------------------------- inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage. udevd/5561 [HC0[0]:SC1[1]:HE0:SE0] takes: ffff88817fffc728 (&pgdat->memcg_lru.lock){+.?.}-{2:2}, at: spin_lock include/linux/spinlock.h:350 [inline] ffff88817fffc728 (&pgdat->memcg_lru.lock){+.?.}-{2:2}, at: lru_gen_rotate_memcg+0x64/0xab0 mm/vmscan.c:4734 {SOFTIRQ-ON-W} state was registered at: lock_acquire kernel/locking/lockdep.c:5705 [inline] lock_acquire+0x1b1/0x520 kernel/locking/lockdep.c:5670 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154 spin_lock include/linux/spinlock.h:350 [inline] lru_gen_online_memcg+0x16b/0x5a0 mm/vmscan.c:4782 mem_cgroup_css_online+0x227/0x3b0 mm/memcontrol.c:5468 online_css+0xaf/0x2a0 kernel/cgroup/cgroup.c:5505 cgroup_init_subsys+0x46b/0x900 kernel/cgroup/cgroup.c:6036 cgroup_init+0xb83/0x1090 kernel/cgroup/cgroup.c:6120 start_kernel+0x398/0x490 init/main.c:1077 x86_64_start_reservations+0x18/0x30 arch/x86/kernel/head64.c:556 x86_64_start_kernel+0xb3/0xc0 arch/x86/kernel/head64.c:537 secondary_startup_64_no_verify+0xf4/0xfb irq event stamp: 18856323 hardirqs last enabled at (18856322): [] mod_memcg_state include/linux/memcontrol.h:982 [inline] hardirqs last enabled at (18856322): [] memcg_account_kmem+0x4f/0x80 mm/memcontrol.c:3094 hardirqs last disabled at (18856323): [] uncharge_batch+0x1c7/0x560 mm/memcontrol.c:7142 softirqs last enabled at (18854500): [] invoke_softirq kernel/softirq.c:445 [inline] softirqs last enabled at (18854500): [] __irq_exit_rcu+0x114/0x190 kernel/softirq.c:650 softirqs last disabled at (18856043): [] invoke_softirq kernel/softirq.c:445 [inline] softirqs last disabled at (18856043): [] __irq_exit_rcu+0x114/0x190 kernel/softirq.c:650 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&pgdat->memcg_lru.lock); lock(&pgdat->memcg_lru.lock); *** DEADLOCK *** 2 locks held by udevd/5561: #0: ffffffff8cff0450 (tomoyo_ss){.+.+}-{0:0}, at: tomoyo_check_open_permission+0xec/0x3a0 security/tomoyo/file.c:761 #1: ffffffff8c796020 (rcu_callback){....}-{0:0}, at: rcu_do_batch kernel/rcu/tree.c:2104 [inline] #1: ffffffff8c796020 (rcu_callback){....}-{0:0}, at: rcu_core+0x791/0x1ad0 kernel/rcu/tree.c:2377 stack backtrace: CPU: 0 PID: 5561 Comm: udevd Not tainted 6.4.0-syzkaller #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 print_usage_bug kernel/locking/lockdep.c:3949 [inline] valid_state kernel/locking/lockdep.c:3991 [inline] mark_lock_irq kernel/locking/lockdep.c:4194 [inline] mark_lock.part.0+0x1110/0x1970 kernel/locking/lockdep.c:4656 mark_lock kernel/locking/lockdep.c:4620 [inline] mark_usage kernel/locking/lockdep.c:4545 [inline] __lock_acquire+0x1227/0x5f30 kernel/locking/lockdep.c:5042 lock_acquire kernel/locking/lockdep.c:5705 [inline] lock_acquire+0x1b1/0x520 kernel/locking/lockdep.c:5670 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154 spin_lock include/linux/spinlock.h:350 [inline] lru_gen_rotate_memcg+0x64/0xab0 mm/vmscan.c:4734 lru_gen_soft_reclaim+0x62/0x70 mm/vmscan.c:4837 uncharge_batch+0x2be/0x560 mm/memcontrol.c:7145 __mem_cgroup_uncharge+0x11f/0x290 mm/memcontrol.c:7221 mem_cgroup_uncharge include/linux/memcontrol.h:698 [inline] __folio_put_small mm/swap.c:105 [inline] __folio_put+0xb6/0x140 mm/swap.c:129 folio_put include/linux/mm.h:1430 [inline] put_page include/linux/mm.h:1499 [inline] free_page_and_swap_cache+0x257/0x2c0 mm/swap_state.c:305 __tlb_remove_table arch/x86/include/asm/tlb.h:34 [inline] __tlb_remove_table_free mm/mmu_gather.c:153 [inline] tlb_remove_table_rcu+0x89/0xe0 mm/mmu_gather.c:208 rcu_do_batch kernel/rcu/tree.c:2115 [inline] rcu_core+0x806/0x1ad0 kernel/rcu/tree.c:2377 __do_softirq+0x1d4/0x905 kernel/softirq.c:571 invoke_softirq kernel/softirq.c:445 [inline] __irq_exit_rcu+0x114/0x190 kernel/softirq.c:650 irq_exit_rcu+0x9/0x20 kernel/softirq.c:662 sysvec_apic_timer_interrupt+0x97/0xc0 arch/x86/kernel/apic/apic.c:1106 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645 RIP: 0010:prefetchw arch/x86/include/asm/processor.h:619 [inline] RIP: 0010:slab_alloc_node mm/slab.c:3252 [inline] RIP: 0010:__kmem_cache_alloc_node+0x12c/0x3f0 mm/slab.c:3540 Code: c0 ff ff 49 89 c7 48 85 db 4c 89 7c 24 08 0f 85 a3 01 00 00 9c 58 f6 c4 02 0f 85 14 02 00 00 48 85 db 74 01 fb 48 8b 74 24 08 <0f> 0d 0e 0f 1f 44 00 00 48 83 7d 40 00 0f 84 8b 00 00 00 44 23 25 RSP: 0018:ffffc90006047728 EFLAGS: 00000206 RAX: 0000000000000006 RBX: 0000000000000200 RCX: 1ffffffff22a7126 RDX: 0000000000000000 RSI: ffff88812b6d8000 RDI: 0000000000000000 RBP: ffff888012440900 R08: 0000000000000001 R09: ffffffff91520d3f R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000c40 R13: 0000000000000000 R14: 0000000000000000 R15: ffff88812b6d8000 __do_kmalloc_node mm/slab_common.c:965 [inline] __kmalloc+0x4e/0x190 mm/slab_common.c:979 kmalloc include/linux/slab.h:563 [inline] tomoyo_realpath_from_path+0xc3/0x600 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_check_open_permission+0x29a/0x3a0 security/tomoyo/file.c:771 tomoyo_file_open security/tomoyo/tomoyo.c:332 [inline] tomoyo_file_open+0xa1/0xc0 security/tomoyo/tomoyo.c:327 security_file_open+0x49/0xb0 security/security.c:2797 do_dentry_open+0x575/0x13f0 fs/open.c:907 do_open fs/namei.c:3636 [inline] path_openat+0x1baa/0x2750 fs/namei.c:3791 do_filp_open+0x1ba/0x410 fs/namei.c:3818 do_sys_openat2+0x16d/0x4c0 fs/open.c:1356 do_sys_open fs/open.c:1372 [inline] __do_sys_openat fs/open.c:1388 [inline] __se_sys_openat fs/open.c:1383 [inline] __x64_sys_openat+0x143/0x1f0 fs/open.c:1383 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fb7825169a4 Code: 24 20 48 8d 44 24 30 48 89 44 24 28 64 8b 04 25 18 00 00 00 85 c0 75 2c 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 76 60 48 8b 15 55 a4 0d 00 f7 d8 64 89 02 48 83 RSP: 002b:00007ffc5b09c0d0 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00005579099fad20 RCX: 00007fb7825169a4 RDX: 00000000000a0800 RSI: 00005579098e5f00 RDI: 00000000ffffff9c RBP: 00005579098e5f00 R08: 0000000000000006 R09: c4caa269b20cd890 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000000a0800 R13: 000055790992c6c0 R14: 0000000000000001 R15: 00005579098cf2c0 ---------------- Code disassembly (best guess): 0: c0 ff ff sar $0xff,%bh 3: 49 89 c7 mov %rax,%r15 6: 48 85 db test %rbx,%rbx 9: 4c 89 7c 24 08 mov %r15,0x8(%rsp) e: 0f 85 a3 01 00 00 jne 0x1b7 14: 9c pushfq 15: 58 pop %rax 16: f6 c4 02 test $0x2,%ah 19: 0f 85 14 02 00 00 jne 0x233 1f: 48 85 db test %rbx,%rbx 22: 74 01 je 0x25 24: fb sti 25: 48 8b 74 24 08 mov 0x8(%rsp),%rsi * 2a: 0f 0d 0e prefetchw (%rsi) <-- trapping instruction 2d: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) 32: 48 83 7d 40 00 cmpq $0x0,0x40(%rbp) 37: 0f 84 8b 00 00 00 je 0xc8 3d: 44 rex.R 3e: 23 .byte 0x23 3f: 25 .byte 0x25