====================================================== WARNING: possible circular locking dependency detected 5.17.0-rc5-next-20220222-syzkaller #0 Not tainted ------------------------------------------------------ udevd/2961 is trying to acquire lock: ffff888010c69818 (&pool->lock/1){-.-.}-{2:2}, at: __queue_work+0x366/0x1140 kernel/workqueue.c:1474 but task is already holding lock: ffffffff9061a530 (&port_lock_key){-...}-{2:2}, at: serial8250_handle_irq.part.0+0x21/0x3d0 drivers/tty/serial/8250/8250_port.c:1916 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&port_lock_key){-...}-{2:2}: __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:162 serial8250_console_write+0x91a/0xb70 drivers/tty/serial/8250/8250_port.c:3359 call_console_drivers kernel/printk/printk.c:1953 [inline] console_unlock+0x9bc/0xdd0 kernel/printk/printk.c:2775 vprintk_emit+0x1b4/0x5f0 kernel/printk/printk.c:2273 vprintk+0x80/0x90 kernel/printk/printk_safe.c:50 _printk+0xba/0xed kernel/printk/printk.c:2294 register_console kernel/printk/printk.c:3132 [inline] register_console+0x410/0x7c0 kernel/printk/printk.c:3013 univ8250_console_init+0x3a/0x46 drivers/tty/serial/8250/8250_core.c:679 console_init+0x3c1/0x58d kernel/printk/printk.c:3232 start_kernel+0x30b/0x4a0 init/main.c:1068 secondary_startup_64_no_verify+0xc3/0xcb -> #2 (console_owner){....}-{0:0}: console_lock_spinning_enable kernel/printk/printk.c:1795 [inline] console_unlock+0x3b1/0xdd0 kernel/printk/printk.c:2772 vprintk_emit+0x1b4/0x5f0 kernel/printk/printk.c:2273 vprintk+0x80/0x90 kernel/printk/printk_safe.c:50 _printk+0xba/0xed kernel/printk/printk.c:2294 warn_flush_attempt kernel/workqueue.c:2613 [inline] check_flush_dependency.cold+0x18/0x4e kernel/workqueue.c:2635 start_flush_work kernel/workqueue.c:3049 [inline] __flush_work+0x25a/0xb10 kernel/workqueue.c:3091 flush_all_cpus_locked+0x148/0x1b0 mm/slub.c:2728 flush_all mm/slub.c:2737 [inline] __kmem_cache_shrink+0x11/0x20 mm/slub.c:4640 acpi_os_purge_cache+0x11/0x20 drivers/acpi/osl.c:1666 acpi_purge_cached_objects+0x37/0xd0 drivers/acpi/acpica/utxface.c:237 acpi_initialize_objects+0x2b/0x95 drivers/acpi/acpica/utxfinit.c:250 acpi_bus_init drivers/acpi/bus.c:1237 [inline] acpi_init+0x1d2/0x976 drivers/acpi/bus.c:1325 do_one_initcall+0x103/0x650 init/main.c:1302 do_initcall_level init/main.c:1375 [inline] do_initcalls init/main.c:1391 [inline] do_basic_setup init/main.c:1410 [inline] kernel_init_freeable+0x6b1/0x73a init/main.c:1615 kernel_init+0x1a/0x1d0 init/main.c:1504 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 -> #1 (&pool->lock){-.-.}-{2:2}: __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154 __queue_work+0x366/0x1140 kernel/workqueue.c:1474 queue_work_on+0xee/0x110 kernel/workqueue.c:1545 queue_work include/linux/workqueue.h:514 [inline] schedule_work include/linux/workqueue.h:575 [inline] put_pwq kernel/workqueue.c:1139 [inline] put_pwq+0x161/0x1b0 kernel/workqueue.c:1124 put_pwq_unlocked kernel/workqueue.c:1156 [inline] put_pwq_unlocked kernel/workqueue.c:1148 [inline] apply_wqattrs_cleanup+0x1e9/0x2d0 kernel/workqueue.c:3961 apply_workqueue_attrs_locked+0xe1/0x140 kernel/workqueue.c:4098 apply_workqueue_attrs+0x2c/0x50 kernel/workqueue.c:4129 padata_setup_cpumasks kernel/padata.c:422 [inline] padata_alloc+0x1bd/0x370 kernel/padata.c:1001 pcrypt_init_padata+0x1b/0xf5 crypto/pcrypt.c:323 pcrypt_init+0x70/0xef crypto/pcrypt.c:348 do_one_initcall+0x103/0x650 init/main.c:1302 do_initcall_level init/main.c:1375 [inline] do_initcalls init/main.c:1391 [inline] do_basic_setup init/main.c:1410 [inline] kernel_init_freeable+0x6b1/0x73a init/main.c:1615 kernel_init+0x1a/0x1d0 init/main.c:1504 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 -> #0 (&pool->lock/1){-.-.}-{2:2}: check_prev_add kernel/locking/lockdep.c:3096 [inline] check_prevs_add kernel/locking/lockdep.c:3219 [inline] validate_chain kernel/locking/lockdep.c:3834 [inline] __lock_acquire+0x2ac6/0x56c0 kernel/locking/lockdep.c:5060 lock_acquire kernel/locking/lockdep.c:5672 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5637 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154 __queue_work+0x366/0x1140 kernel/workqueue.c:1474 queue_work_on+0xee/0x110 kernel/workqueue.c:1545 serial8250_rx_chars+0xcc/0xf0 drivers/tty/serial/8250/8250_port.c:1798 serial8250_handle_irq.part.0+0x292/0x3d0 drivers/tty/serial/8250/8250_port.c:1935 serial8250_handle_irq drivers/tty/serial/8250/8250_port.c:1913 [inline] serial8250_default_handle_irq+0xb2/0x220 drivers/tty/serial/8250/8250_port.c:1957 serial8250_interrupt+0xfd/0x200 drivers/tty/serial/8250/8250_core.c:126 __handle_irq_event_percpu+0x22b/0x880 kernel/irq/handle.c:158 handle_irq_event_percpu kernel/irq/handle.c:193 [inline] handle_irq_event+0xa7/0x1e0 kernel/irq/handle.c:210 handle_edge_irq+0x25f/0xd00 kernel/irq/chip.c:817 generic_handle_irq_desc include/linux/irqdesc.h:158 [inline] handle_irq arch/x86/kernel/irq.c:231 [inline] __common_interrupt+0x9d/0x210 arch/x86/kernel/irq.c:250 common_interrupt+0xa4/0xc0 arch/x86/kernel/irq.c:240 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:629 preempt_latency_start kernel/sched/core.c:5474 [inline] preempt_latency_start kernel/sched/core.c:5469 [inline] preempt_count_add+0xa3/0x140 kernel/sched/core.c:5497 unwind_next_frame+0x120/0x1ce0 arch/x86/kernel/unwind_orc.c:428 arch_stack_walk+0x7d/0xe0 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x8c/0xc0 kernel/stacktrace.c:122 kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc mm/kasan/common.c:515 [inline] ____kasan_kmalloc mm/kasan/common.c:474 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:524 kmalloc include/linux/slab.h:586 [inline] tomoyo_realpath_from_path+0xc3/0x620 security/tomoyo/realpath.c:254 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x21b/0x400 security/tomoyo/file.c:822 security_inode_getattr+0xcf/0x140 security/security.c:1350 vfs_getattr fs/stat.c:157 [inline] vfs_statx+0x164/0x390 fs/stat.c:225 vfs_fstatat fs/stat.c:243 [inline] __do_sys_newfstatat+0x96/0x120 fs/stat.c:412 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae other info that might help us debug this: Chain exists of: &pool->lock/1 --> console_owner --> &port_lock_key Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&port_lock_key); lock(console_owner); lock(&port_lock_key); lock(&pool->lock/1); *** DEADLOCK *** 4 locks held by udevd/2961: #0: ffffffff8c379ec8 (tomoyo_ss){....}-{0:0}, at: tomoyo_path_perm+0x1c1/0x400 security/tomoyo/file.c:847 #1: ffff88807bea2eb0 (&i->lock){-...}-{2:2}, at: spin_lock include/linux/spinlock.h:354 [inline] #1: ffff88807bea2eb0 (&i->lock){-...}-{2:2}, at: serial8250_interrupt+0x3a/0x200 drivers/tty/serial/8250/8250_core.c:116 #2: ffffffff9061a530 (&port_lock_key){-...}-{2:2}, at: serial8250_handle_irq.part.0+0x21/0x3d0 drivers/tty/serial/8250/8250_port.c:1916 #3: ffffffff8bb866a0 (rcu_read_lock){....}-{1:2}, at: __queue_work+0xd0/0x1140 kernel/workqueue.c:1437 stack backtrace: CPU: 0 PID: 2961 Comm: udevd Not tainted 5.17.0-rc5-next-20220222-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2176 check_prev_add kernel/locking/lockdep.c:3096 [inline] check_prevs_add kernel/locking/lockdep.c:3219 [inline] validate_chain kernel/locking/lockdep.c:3834 [inline] __lock_acquire+0x2ac6/0x56c0 kernel/locking/lockdep.c:5060 lock_acquire kernel/locking/lockdep.c:5672 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5637 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154 __queue_work+0x366/0x1140 kernel/workqueue.c:1474 queue_work_on+0xee/0x110 kernel/workqueue.c:1545 serial8250_rx_chars+0xcc/0xf0 drivers/tty/serial/8250/8250_port.c:1798 serial8250_handle_irq.part.0+0x292/0x3d0 drivers/tty/serial/8250/8250_port.c:1935 serial8250_handle_irq drivers/tty/serial/8250/8250_port.c:1913 [inline] serial8250_default_handle_irq+0xb2/0x220 drivers/tty/serial/8250/8250_port.c:1957 serial8250_interrupt+0xfd/0x200 drivers/tty/serial/8250/8250_core.c:126 __handle_irq_event_percpu+0x22b/0x880 kernel/irq/handle.c:158 handle_irq_event_percpu kernel/irq/handle.c:193 [inline] handle_irq_event+0xa7/0x1e0 kernel/irq/handle.c:210 handle_edge_irq+0x25f/0xd00 kernel/irq/chip.c:817 generic_handle_irq_desc include/linux/irqdesc.h:158 [inline] handle_irq arch/x86/kernel/irq.c:231 [inline] __common_interrupt+0x9d/0x210 arch/x86/kernel/irq.c:250 common_interrupt+0xa4/0xc0 arch/x86/kernel/irq.c:240 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:629 RIP: 0010:preempt_latency_start kernel/sched/core.c:5474 [inline] RIP: 0010:preempt_latency_start kernel/sched/core.c:5469 [inline] RIP: 0010:preempt_count_add+0xa3/0x140 kernel/sched/core.c:5497 Code: 48 8b 2c 25 00 70 02 00 48 8d bd 58 14 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 81 00 00 00 <48> 89 9d 58 14 00 00 5b 5d c3 31 ff 31 db e8 7a 27 0d 00 eb c0 e8 RSP: 0018:ffffc9000c78f5f8 EFLAGS: 00000246 RAX: dffffc0000000000 RBX: ffffffff8134bb40 RCX: 1ffffffff2069938 RDX: 1ffff1100f88c9cb RSI: 0000000000000000 RDI: ffff88807c464e58 RBP: ffff88807c463a00 R08: ffffffff8e0fb678 R09: 0000000000000001 R10: fffff520018f1ee8 R11: 0000000000088078 R12: ffffc9000c78f730 R13: 0000000000000000 R14: ffffc9000c78f6e8 R15: 0000000000001000 unwind_next_frame+0x120/0x1ce0 arch/x86/kernel/unwind_orc.c:428 arch_stack_walk+0x7d/0xe0 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x8c/0xc0 kernel/stacktrace.c:122 kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc mm/kasan/common.c:515 [inline] ____kasan_kmalloc mm/kasan/common.c:474 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:524 kmalloc include/linux/slab.h:586 [inline] tomoyo_realpath_from_path+0xc3/0x620 security/tomoyo/realpath.c:254 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x21b/0x400 security/tomoyo/file.c:822 security_inode_getattr+0xcf/0x140 security/security.c:1350 vfs_getattr fs/stat.c:157 [inline] vfs_statx+0x164/0x390 fs/stat.c:225 vfs_fstatat fs/stat.c:243 [inline] __do_sys_newfstatat+0x96/0x120 fs/stat.c:412 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f0f42d251da Code: 48 89 f2 b9 00 01 00 00 48 89 fe bf 9c ff ff ff e9 0b 00 00 00 66 2e 0f 1f 84 00 00 00 00 00 90 41 89 ca b8 06 01 00 00 0f 05 <3d> 00 f0 ff ff 77 07 31 c0 c3 0f 1f 40 00 48 8b 15 69 fc 0c 00 f7 RSP: 002b:00007fffb2651d48 EFLAGS: 00000202 ORIG_RAX: 0000000000000106 RAX: ffffffffffffffda RBX: 00005642d41bdde0 RCX: 00007f0f42d251da RDX: 00007fffb2651d50 RSI: 00007f0f42dbb75a RDI: 000000000000000d RBP: 000000000000000d R08: 0000000000090800 R09: 00005642d41c5f30 R10: 0000000000001000 R11: 0000000000000202 R12: 00007fffb2651d50 R13: 00000000000000ff R14: 00007fffb2651e40 R15: 0000000000000000 ---------------- Code disassembly (best guess): 0: 48 8b 2c 25 00 70 02 mov 0x27000,%rbp 7: 00 8: 48 8d bd 58 14 00 00 lea 0x1458(%rbp),%rdi f: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax 16: fc ff df 19: 48 89 fa mov %rdi,%rdx 1c: 48 c1 ea 03 shr $0x3,%rdx 20: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) 24: 0f 85 81 00 00 00 jne 0xab * 2a: 48 89 9d 58 14 00 00 mov %rbx,0x1458(%rbp) <-- trapping instruction 31: 5b pop %rbx 32: 5d pop %rbp 33: c3 retq 34: 31 ff xor %edi,%edi 36: 31 db xor %ebx,%ebx 38: e8 7a 27 0d 00 callq 0xd27b7 3d: eb c0 jmp 0xffffffff 3f: e8 .byte 0xe8