====================================================== WARNING: possible circular locking dependency detected 6.2.0-rc6-syzkaller-00003-g22b8077d0fce #0 Not tainted ------------------------------------------------------ syz-executor.1/27085 is trying to acquire lock: ffffffff8d5fc528 (zonelist_update_seq.seqcount){...-}-{0:0}, at: read_seqbegin include/linux/seqlock.h:836 [inline] ffffffff8d5fc528 (zonelist_update_seq.seqcount){...-}-{0:0}, at: zonelist_iter_begin mm/page_alloc.c:4722 [inline] ffffffff8d5fc528 (zonelist_update_seq.seqcount){...-}-{0:0}, at: __alloc_pages_slowpath+0x297/0x2120 mm/page_alloc.c:5044 but task is already holding lock: ffff88802d920958 (&port->lock){-.-.}-{2:2}, at: tty_insert_flip_string_and_push_buffer+0x39/0x3b0 drivers/tty/tty_buffer.c:628 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&port->lock){-.-.}-{2:2}: lock_acquire+0x1a7/0x400 kernel/locking/lockdep.c:5668 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162 tty_port_tty_get drivers/tty/tty_port.c:327 [inline] tty_port_default_wakeup+0x1f/0xf0 drivers/tty/tty_port.c:68 serial8250_tx_chars+0x6be/0x8c0 drivers/tty/serial/8250/8250_port.c:1858 serial8250_handle_irq+0x3e3/0x560 drivers/tty/serial/8250/8250_port.c:1948 serial8250_default_handle_irq+0xaf/0x190 drivers/tty/serial/8250/8250_port.c:1968 serial8250_interrupt+0xa3/0x1e0 drivers/tty/serial/8250/8250_core.c:127 __handle_irq_event_percpu+0x200/0x620 kernel/irq/handle.c:158 handle_irq_event_percpu kernel/irq/handle.c:193 [inline] handle_irq_event+0x83/0x1e0 kernel/irq/handle.c:210 handle_edge_irq+0x245/0xbe0 kernel/irq/chip.c:819 generic_handle_irq_desc include/linux/irqdesc.h:158 [inline] handle_irq arch/x86/kernel/irq.c:231 [inline] __common_interrupt+0xce/0x1e0 arch/x86/kernel/irq.c:250 common_interrupt+0x9f/0xc0 arch/x86/kernel/irq.c:240 asm_common_interrupt+0x22/0x40 arch/x86/include/asm/idtentry.h:640 native_safe_halt arch/x86/include/asm/irqflags.h:51 [inline] arch_safe_halt arch/x86/include/asm/irqflags.h:89 [inline] acpi_safe_halt drivers/acpi/processor_idle.c:112 [inline] acpi_idle_do_entry drivers/acpi/processor_idle.c:570 [inline] acpi_idle_enter+0x43d/0x800 drivers/acpi/processor_idle.c:707 cpuidle_enter_state+0x50b/0xf50 drivers/cpuidle/cpuidle.c:239 cpuidle_enter+0x59/0x90 drivers/cpuidle/cpuidle.c:356 call_cpuidle kernel/sched/idle.c:155 [inline] cpuidle_idle_call kernel/sched/idle.c:236 [inline] do_idle+0x3da/0x680 kernel/sched/idle.c:303 cpu_startup_entry+0x15/0x20 kernel/sched/idle.c:400 rest_init+0x24f/0x270 init/main.c:732 arch_call_rest_init+0xa/0x10 init/main.c:894 start_kernel+0x48e/0x540 init/main.c:1148 secondary_startup_64_no_verify+0xcf/0xdb -> #2 (&port_lock_key){-.-.}-{2:2}: lock_acquire+0x1a7/0x400 kernel/locking/lockdep.c:5668 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162 serial8250_console_write+0x1a9/0x1ac0 drivers/tty/serial/8250/8250_port.c:3394 call_console_driver kernel/printk/printk.c:2033 [inline] console_emit_next_record+0x7aa/0xa70 kernel/printk/printk.c:2825 console_flush_all+0x2d4/0x6f0 console_unlock+0xfa/0x270 kernel/printk/printk.c:2966 vprintk_emit+0xd1/0x1e0 kernel/printk/printk.c:2359 _printk+0xcf/0x110 kernel/printk/printk.c:2380 register_console+0xb38/0x1110 kernel/printk/printk.c:3417 univ8250_console_init+0x41/0x50 drivers/tty/serial/8250/8250_core.c:688 console_init+0x5d/0xb0 kernel/printk/printk.c:3560 start_kernel+0x2fc/0x540 init/main.c:1077 secondary_startup_64_no_verify+0xcf/0xdb -> #1 (console_owner){-.-.}-{0:0}: lock_acquire+0x1a7/0x400 kernel/locking/lockdep.c:5668 console_lock_spinning_enable+0x52/0x60 kernel/printk/printk.c:1889 console_emit_next_record+0x6c9/0xa70 kernel/printk/printk.c:2822 console_flush_all+0x2d4/0x6f0 console_unlock+0xfa/0x270 kernel/printk/printk.c:2966 vprintk_emit+0xd1/0x1e0 kernel/printk/printk.c:2359 _printk+0xcf/0x110 kernel/printk/printk.c:2380 build_zonelists+0x3b0/0x450 mm/page_alloc.c:6497 __build_all_zonelists+0x108/0x180 mm/page_alloc.c:6610 build_all_zonelists_init+0x1f/0x180 mm/page_alloc.c:6635 build_all_zonelists+0x3d/0x2f0 mm/page_alloc.c:6668 start_kernel+0xd6/0x540 init/main.c:971 secondary_startup_64_no_verify+0xcf/0xdb -> #0 (zonelist_update_seq.seqcount){...-}-{0:0}: check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain+0x184a/0x6470 kernel/locking/lockdep.c:3831 __lock_acquire+0x1292/0x1f60 kernel/locking/lockdep.c:5055 lock_acquire+0x1a7/0x400 kernel/locking/lockdep.c:5668 seqcount_lockdep_reader_access+0xe9/0x1e0 include/linux/seqlock.h:102 read_seqbegin include/linux/seqlock.h:836 [inline] zonelist_iter_begin mm/page_alloc.c:4722 [inline] __alloc_pages_slowpath+0x297/0x2120 mm/page_alloc.c:5044 __alloc_pages+0x3d4/0x560 mm/page_alloc.c:5562 alloc_slab_page+0xbd/0x190 mm/slub.c:1851 allocate_slab+0x5e/0x3c0 mm/slub.c:1998 new_slab mm/slub.c:2051 [inline] ___slab_alloc+0x7f4/0xeb0 mm/slub.c:3193 __slab_alloc mm/slub.c:3292 [inline] __slab_alloc_node mm/slub.c:3345 [inline] slab_alloc_node mm/slub.c:3442 [inline] __kmem_cache_alloc_node+0x25b/0x340 mm/slub.c:3491 __do_kmalloc_node mm/slab_common.c:967 [inline] __kmalloc+0x9e/0x190 mm/slab_common.c:981 kmalloc include/linux/slab.h:584 [inline] tty_buffer_alloc drivers/tty/tty_buffer.c:180 [inline] __tty_buffer_request_room+0x1e3/0x550 drivers/tty/tty_buffer.c:278 tty_insert_flip_string_fixed_flag drivers/tty/tty_buffer.c:327 [inline] tty_insert_flip_string include/linux/tty_flip.h:41 [inline] tty_insert_flip_string_and_push_buffer+0x91/0x3b0 drivers/tty/tty_buffer.c:629 n_tty_write+0x62c/0x12e0 drivers/tty/n_tty.c:2373 do_tty_write drivers/tty/tty_io.c:1018 [inline] file_tty_write+0x542/0x8d0 drivers/tty/tty_io.c:1089 call_write_iter include/linux/fs.h:2189 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x7b5/0xbb0 fs/read_write.c:584 ksys_write+0x19b/0x2c0 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd other info that might help us debug this: Chain exists of: zonelist_update_seq.seqcount --> &port_lock_key --> &port->lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&port->lock); lock(&port_lock_key); lock(&port->lock); lock(zonelist_update_seq.seqcount); *** DEADLOCK *** 5 locks held by syz-executor.1/27085: #0: ffff88808b7c1098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref_wait+0x21/0x70 drivers/tty/tty_ldisc.c:244 #1: ffff88808b7c1130 (&tty->atomic_write_lock){+.+.}-{3:3}, at: tty_write_lock drivers/tty/tty_io.c:944 [inline] #1: ffff88808b7c1130 (&tty->atomic_write_lock){+.+.}-{3:3}, at: do_tty_write drivers/tty/tty_io.c:967 [inline] #1: ffff88808b7c1130 (&tty->atomic_write_lock){+.+.}-{3:3}, at: file_tty_write+0x226/0x8d0 drivers/tty/tty_io.c:1089 #2: ffff88808b7c12e8 (&tty->termios_rwsem){++++}-{3:3}, at: n_tty_write+0x248/0x12e0 drivers/tty/n_tty.c:2333 #3: ffffc900047ed380 (&ldata->output_lock){+.+.}-{3:3}, at: n_tty_write+0x5ea/0x12e0 drivers/tty/n_tty.c:2372 #4: ffff88802d920958 (&port->lock){-.-.}-{2:2}, at: tty_insert_flip_string_and_push_buffer+0x39/0x3b0 drivers/tty/tty_buffer.c:628 stack backtrace: CPU: 0 PID: 27085 Comm: syz-executor.1 Not tainted 6.2.0-rc6-syzkaller-00003-g22b8077d0fce #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106 check_noncircular+0x2f9/0x3b0 kernel/locking/lockdep.c:2177 check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain+0x184a/0x6470 kernel/locking/lockdep.c:3831 __lock_acquire+0x1292/0x1f60 kernel/locking/lockdep.c:5055 lock_acquire+0x1a7/0x400 kernel/locking/lockdep.c:5668 seqcount_lockdep_reader_access+0xe9/0x1e0 include/linux/seqlock.h:102 read_seqbegin include/linux/seqlock.h:836 [inline] zonelist_iter_begin mm/page_alloc.c:4722 [inline] __alloc_pages_slowpath+0x297/0x2120 mm/page_alloc.c:5044 __alloc_pages+0x3d4/0x560 mm/page_alloc.c:5562 alloc_slab_page+0xbd/0x190 mm/slub.c:1851 allocate_slab+0x5e/0x3c0 mm/slub.c:1998 new_slab mm/slub.c:2051 [inline] ___slab_alloc+0x7f4/0xeb0 mm/slub.c:3193 __slab_alloc mm/slub.c:3292 [inline] __slab_alloc_node mm/slub.c:3345 [inline] slab_alloc_node mm/slub.c:3442 [inline] __kmem_cache_alloc_node+0x25b/0x340 mm/slub.c:3491 __do_kmalloc_node mm/slab_common.c:967 [inline] __kmalloc+0x9e/0x190 mm/slab_common.c:981 kmalloc include/linux/slab.h:584 [inline] tty_buffer_alloc drivers/tty/tty_buffer.c:180 [inline] __tty_buffer_request_room+0x1e3/0x550 drivers/tty/tty_buffer.c:278 tty_insert_flip_string_fixed_flag drivers/tty/tty_buffer.c:327 [inline] tty_insert_flip_string include/linux/tty_flip.h:41 [inline] tty_insert_flip_string_and_push_buffer+0x91/0x3b0 drivers/tty/tty_buffer.c:629 n_tty_write+0x62c/0x12e0 drivers/tty/n_tty.c:2373 do_tty_write drivers/tty/tty_io.c:1018 [inline] file_tty_write+0x542/0x8d0 drivers/tty/tty_io.c:1089 call_write_iter include/linux/fs.h:2189 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x7b5/0xbb0 fs/read_write.c:584 ksys_write+0x19b/0x2c0 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fc4f968c0c9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fc4fa331168 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007fc4f97abf80 RCX: 00007fc4f968c0c9 RDX: 000000000000ff2e RSI: 00000000200000c0 RDI: 0000000000000005 RBP: 00007fc4f96e7ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fffcf4eae8f R14: 00007fc4fa331300 R15: 0000000000022000