====================================================== WARNING: possible circular locking dependency detected 5.2.0-rc5+ #2 Not tainted ------------------------------------------------------ syz-executor.0/14255 is trying to acquire lock: 0000000075cf9651 (console_owner){-.-.}, at: log_next kernel/printk/printk.c:506 [inline] 0000000075cf9651 (console_owner){-.-.}, at: console_unlock+0x3fc/0xec0 kernel/printk/printk.c:2450 but task is already holding lock: 0000000053780d4b (&(&port->lock)->rlock){-.-.}, at: pty_write+0xff/0x200 drivers/tty/pty.c:120 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&(&port->lock)->rlock){-.-.}: __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x95/0xcd kernel/locking/spinlock.c:159 tty_port_tty_get+0x22/0x80 drivers/tty/tty_port.c:287 tty_port_default_wakeup+0x16/0x40 drivers/tty/tty_port.c:47 tty_port_tty_wakeup+0x57/0x70 drivers/tty/tty_port.c:387 uart_write_wakeup+0x46/0x70 drivers/tty/serial/serial_core.c:103 serial8250_tx_chars+0x495/0xaf0 drivers/tty/serial/8250/8250_port.c:1806 serial8250_handle_irq.part.0+0x1b9/0x2e0 drivers/tty/serial/8250/8250_port.c:1879 serial8250_handle_irq drivers/tty/serial/8250/8250_port.c:1865 [inline] serial8250_default_handle_irq+0xc0/0x150 drivers/tty/serial/8250/8250_port.c:1895 serial8250_interrupt+0xf1/0x1a0 drivers/tty/serial/8250/8250_core.c:125 __handle_irq_event_percpu+0x144/0x8f0 kernel/irq/handle.c:149 handle_irq_event_percpu+0x74/0x160 kernel/irq/handle.c:189 handle_irq_event+0xa7/0x134 kernel/irq/handle.c:206 handle_edge_irq+0x25e/0x8d0 kernel/irq/chip.c:822 generic_handle_irq_desc include/linux/irqdesc.h:156 [inline] handle_irq+0x39/0x50 arch/x86/kernel/irq_64.c:34 do_IRQ+0x99/0x1d0 arch/x86/kernel/irq.c:247 ret_from_intr+0x0/0x1e native_safe_halt+0xe/0x10 arch/x86/include/asm/irqflags.h:60 arch_cpu_idle+0xa/0x10 arch/x86/kernel/process.c:571 default_idle_call+0x36/0x90 kernel/sched/idle.c:94 cpuidle_idle_call kernel/sched/idle.c:154 [inline] do_idle+0x377/0x560 kernel/sched/idle.c:263 cpu_startup_entry+0x1b/0x20 kernel/sched/idle.c:354 start_secondary+0x34e/0x4c0 arch/x86/kernel/smpboot.c:265 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243 -> #1 (&port_lock_key){-.-.}: __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x95/0xcd kernel/locking/spinlock.c:159 serial8250_console_write+0x253/0x9a0 drivers/tty/serial/8250/8250_port.c:3245 univ8250_console_write+0x5f/0x70 drivers/tty/serial/8250/8250_core.c:586 call_console_drivers kernel/printk/printk.c:1781 [inline] console_unlock+0xb3e/0xec0 kernel/printk/printk.c:2463 vprintk_emit+0x2a0/0x700 kernel/printk/printk.c:1986 vprintk_default+0x28/0x30 kernel/printk/printk.c:2013 vprintk_func+0x7e/0x189 kernel/printk/printk_safe.c:386 printk+0xba/0xed kernel/printk/printk.c:2046 register_console+0x745/0xb50 kernel/printk/printk.c:2788 univ8250_console_init+0x3e/0x4b drivers/tty/serial/8250/8250_core.c:681 console_init+0x4f7/0x761 kernel/printk/printk.c:2874 start_kernel+0x5b4/0x893 init/main.c:688 x86_64_start_reservations+0x29/0x2b arch/x86/kernel/head64.c:470 x86_64_start_kernel+0x77/0x7b arch/x86/kernel/head64.c:451 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243 -> #0 (console_owner){-.-.}: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4303 console_lock_spinning_enable kernel/printk/printk.c:1644 [inline] console_unlock+0x466/0xec0 kernel/printk/printk.c:2460 vprintk_emit+0x2a0/0x700 kernel/printk/printk.c:1986 vprintk_default+0x28/0x30 kernel/printk/printk.c:2013 vprintk_func+0x7e/0x189 kernel/printk/printk_safe.c:386 printk+0xba/0xed kernel/printk/printk.c:2046 fail_dump lib/fault-inject.c:45 [inline] should_fail+0x708/0x852 lib/fault-inject.c:144 __should_failslab+0x121/0x190 mm/failslab.c:32 should_failslab+0x9/0x14 mm/slab_common.c:1610 slab_pre_alloc_hook mm/slab.h:420 [inline] slab_alloc mm/slab.c:3312 [inline] __do_kmalloc mm/slab.c:3658 [inline] __kmalloc+0x71/0x740 mm/slab.c:3669 kmalloc include/linux/slab.h:552 [inline] tty_buffer_alloc drivers/tty/tty_buffer.c:175 [inline] __tty_buffer_request_room+0x1fb/0x5c0 drivers/tty/tty_buffer.c:273 tty_insert_flip_string_fixed_flag+0x93/0x1f0 drivers/tty/tty_buffer.c:318 tty_insert_flip_string include/linux/tty_flip.h:37 [inline] pty_write+0x133/0x200 drivers/tty/pty.c:122 tty_send_xchar+0x282/0x380 drivers/tty/tty_io.c:1094 n_tty_ioctl_helper drivers/tty/tty_ioctl.c:927 [inline] n_tty_ioctl_helper+0x192/0x3b0 drivers/tty/tty_ioctl.c:894 n_tty_ioctl+0x59/0x360 drivers/tty/n_tty.c:2466 tty_ioctl+0xaaf/0x14a0 drivers/tty/tty_io.c:2664 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:509 [inline] do_vfs_ioctl+0xd5f/0x1380 fs/ioctl.c:696 ksys_ioctl+0xab/0xd0 fs/ioctl.c:713 __do_sys_ioctl fs/ioctl.c:720 [inline] __se_sys_ioctl fs/ioctl.c:718 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe other info that might help us debug this: Chain exists of: console_owner --> &port_lock_key --> &(&port->lock)->rlock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&(&port->lock)->rlock); lock(&port_lock_key); lock(&(&port->lock)->rlock); lock(console_owner); *** DEADLOCK *** 5 locks held by syz-executor.0/14255: #0: 0000000006381b90 (&tty->ldisc_sem){++++}, at: ldsem_down_read+0x33/0x40 drivers/tty/tty_ldsem.c:341 #1: 00000000d426606d (&tty->atomic_write_lock){+.+.}, at: tty_write_lock+0x23/0x90 drivers/tty/tty_io.c:887 #2: 000000008ce0ee76 (&o_tty->termios_rwsem/1){++++}, at: tty_send_xchar+0x21f/0x380 drivers/tty/tty_io.c:1091 #3: 0000000053780d4b (&(&port->lock)->rlock){-.-.}, at: pty_write+0xff/0x200 drivers/tty/pty.c:120 #4: 00000000dd15b7ec (console_lock){+.+.}, at: console_trylock_spinning kernel/printk/printk.c:1706 [inline] #4: 00000000dd15b7ec (console_lock){+.+.}, at: vprintk_emit+0x283/0x700 kernel/printk/printk.c:1985 stack backtrace: CPU: 1 PID: 14255 Comm: syz-executor.0 Not tainted 5.2.0-rc5+ #2 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x172/0x1f0 lib/dump_stack.c:113 print_circular_bug.cold+0x1cc/0x28f kernel/locking/lockdep.c:1565 check_prev_add kernel/locking/lockdep.c:2310 [inline] check_prevs_add kernel/locking/lockdep.c:2418 [inline] validate_chain kernel/locking/lockdep.c:2800 [inline] __lock_acquire+0x3755/0x5490 kernel/locking/lockdep.c:3793 lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4303 console_lock_spinning_enable kernel/printk/printk.c:1644 [inline] console_unlock+0x466/0xec0 kernel/printk/printk.c:2460 vprintk_emit+0x2a0/0x700 kernel/printk/printk.c:1986 vprintk_default+0x28/0x30 kernel/printk/printk.c:2013 vprintk_func+0x7e/0x189 kernel/printk/printk_safe.c:386 printk+0xba/0xed kernel/printk/printk.c:2046 fail_dump lib/fault-inject.c:45 [inline] should_fail+0x708/0x852 lib/fault-inject.c:144 __should_failslab+0x121/0x190 mm/failslab.c:32 should_failslab+0x9/0x14 mm/slab_common.c:1610 slab_pre_alloc_hook mm/slab.h:420 [inline] slab_alloc mm/slab.c:3312 [inline] __do_kmalloc mm/slab.c:3658 [inline] __kmalloc+0x71/0x740 mm/slab.c:3669 kmalloc include/linux/slab.h:552 [inline] tty_buffer_alloc drivers/tty/tty_buffer.c:175 [inline] __tty_buffer_request_room+0x1fb/0x5c0 drivers/tty/tty_buffer.c:273 tty_insert_flip_string_fixed_flag+0x93/0x1f0 drivers/tty/tty_buffer.c:318 tty_insert_flip_string include/linux/tty_flip.h:37 [inline] pty_write+0x133/0x200 drivers/tty/pty.c:122 tty_send_xchar+0x282/0x380 drivers/tty/tty_io.c:1094 n_tty_ioctl_helper drivers/tty/tty_ioctl.c:927 [inline] n_tty_ioctl_helper+0x192/0x3b0 drivers/tty/tty_ioctl.c:894 n_tty_ioctl+0x59/0x360 drivers/tty/n_tty.c:2466 tty_ioctl+0xaaf/0x14a0 drivers/tty/tty_io.c:2664 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:509 [inline] do_vfs_ioctl+0xd5f/0x1380 fs/ioctl.c:696 ksys_ioctl+0xab/0xd0 fs/ioctl.c:713 __do_sys_ioctl fs/ioctl.c:720 [inline] __se_sys_ioctl fs/ioctl.c:718 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4592c9 Code: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 0f 83 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f0c3ecd9c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f0c3ecd9c90 RCX: 00000000004592c9 RDX: 0000000000000002 RSI: 000000000000540a RDI: 0000000000000003 RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f0c3ecda6d4 R13: 00000000004c386c R14: 00000000004d7250 R15: 0000000000000006