R13: 00000000000000a8 R14: 00000000004c1ee6 R15: 0000000000000001 ttyprintk ttyprintk: tty_port_close_start: tty->count = 1 port count = 2 ====================================================== WARNING: possible circular locking dependency detected 4.19.102-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.3/6270 is trying to acquire lock: 00000000b02aa2a6 (console_owner){-.-.}, at: console_trylock_spinning kernel/printk/printk.c:1669 [inline] 00000000b02aa2a6 (console_owner){-.-.}, at: vprintk_emit+0x3d5/0x6d0 kernel/printk/printk.c:1936 but task is already holding lock: 00000000770a5ec8 (&(&port->lock)->rlock){-.-.}, at: tty_port_close_start.part.0+0x2b/0x570 drivers/tty/tty_port.c:573 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:152 tty_port_tty_get+0x22/0x90 drivers/tty/tty_port.c:288 tty_port_default_wakeup+0x16/0x40 drivers/tty/tty_port.c:47 tty_port_tty_wakeup+0x57/0x70 drivers/tty/tty_port.c:390 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+0x261/0x2b0 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+0xfc/0x1e0 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:797 generic_handle_irq_desc include/linux/irqdesc.h:155 [inline] handle_irq+0x39/0x50 arch/x86/kernel/irq_64.c:87 do_IRQ+0x99/0x1d0 arch/x86/kernel/irq.c:246 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:556 default_idle_call+0x36/0x90 kernel/sched/idle.c:93 cpuidle_idle_call kernel/sched/idle.c:153 [inline] do_idle+0x30c/0x4d0 kernel/sched/idle.c:263 cpu_startup_entry+0xc8/0xe0 kernel/sched/idle.c:369 start_secondary+0x3e8/0x5b0 arch/x86/kernel/smpboot.c:271 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:152 serial8250_console_write+0x7ca/0x9f0 drivers/tty/serial/8250/8250_port.c:3247 univ8250_console_write+0x5f/0x70 drivers/tty/serial/8250/8250_core.c:590 call_console_drivers kernel/printk/printk.c:1736 [inline] console_unlock+0xbdf/0x10d0 kernel/printk/printk.c:2429 vprintk_emit+0x280/0x6d0 kernel/printk/printk.c:1937 vprintk_default+0x28/0x30 kernel/printk/printk.c:1979 vprintk_func+0x7e/0x189 kernel/printk/printk_safe.c:398 printk+0xba/0xed kernel/printk/printk.c:2012 register_console+0x77f/0xb90 kernel/printk/printk.c:2745 univ8250_console_init+0x3e/0x4b drivers/tty/serial/8250/8250_core.c:685 console_init+0x4f7/0x761 kernel/printk/printk.c:2831 start_kernel+0x59c/0x825 init/main.c:660 x86_64_start_reservations+0x29/0x2b arch/x86/kernel/head64.c:490 x86_64_start_kernel+0x77/0x7b arch/x86/kernel/head64.c:471 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243 -> #0 (console_owner){-.-.}: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:3903 console_trylock_spinning kernel/printk/printk.c:1690 [inline] vprintk_emit+0x412/0x6d0 kernel/printk/printk.c:1936 vprintk_default+0x28/0x30 kernel/printk/printk.c:1979 vprintk_func+0x7e/0x189 kernel/printk/printk_safe.c:398 printk+0xba/0xed kernel/printk/printk.c:2012 tty_port_close_start.part.0+0x51a/0x570 drivers/tty/tty_port.c:575 tty_port_close_start drivers/tty/tty_port.c:647 [inline] tty_port_close+0x4e/0xf0 drivers/tty/tty_port.c:640 tpk_close+0x8e/0xa4 drivers/char/ttyprintk.c:111 tty_release+0x3ba/0xe90 drivers/tty/tty_io.c:1678 __fput+0x2dd/0x8b0 fs/file_table.c:278 ____fput+0x16/0x20 fs/file_table.c:309 task_work_run+0x145/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x53d/0x620 arch/x86/entry/common.c:296 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 *** 2 locks held by syz-executor.3/6270: #0: 00000000958b4928 (&tty->legacy_mutex){+.+.}, at: tty_lock+0x73/0xb0 drivers/tty/tty_mutex.c:19 #1: 00000000770a5ec8 (&(&port->lock)->rlock){-.-.}, at: tty_port_close_start.part.0+0x2b/0x570 drivers/tty/tty_port.c:573 stack backtrace: CPU: 0 PID: 6270 Comm: syz-executor.3 Not tainted 4.19.102-syzkaller #0 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+0x197/0x210 lib/dump_stack.c:118 print_circular_bug.isra.0.cold+0x1cc/0x28f kernel/locking/lockdep.c:1221 check_prev_add kernel/locking/lockdep.c:1861 [inline] check_prevs_add kernel/locking/lockdep.c:1974 [inline] validate_chain kernel/locking/lockdep.c:2415 [inline] __lock_acquire+0x2e19/0x49c0 kernel/locking/lockdep.c:3411 lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:3903 console_trylock_spinning kernel/printk/printk.c:1690 [inline] vprintk_emit+0x412/0x6d0 kernel/printk/printk.c:1936 vprintk_default+0x28/0x30 kernel/printk/printk.c:1979 vprintk_func+0x7e/0x189 kernel/printk/printk_safe.c:398 printk+0xba/0xed kernel/printk/printk.c:2012 tty_port_close_start.part.0+0x51a/0x570 drivers/tty/tty_port.c:575 tty_port_close_start drivers/tty/tty_port.c:647 [inline] tty_port_close+0x4e/0xf0 drivers/tty/tty_port.c:640 tpk_close+0x8e/0xa4 drivers/char/ttyprintk.c:111 tty_release+0x3ba/0xe90 drivers/tty/tty_io.c:1678 __fput+0x2dd/0x8b0 fs/file_table.c:278 ____fput+0x16/0x20 fs/file_table.c:309 task_work_run+0x145/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x53d/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x414f31 Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 04 1b 00 00 c3 48 83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01 RSP: 002b:00007fffdf46ddc0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000414f31 RDX: 00000000000f4240 RSI: 0000000000000081 RDI: 0000000000000003 RBP: 0000000000000000 R08: 0000000000760148 R09: ffffffffffffffff R10: 00007fffdf46de90 R11: 0000000000000293 R12: 000000000075bf20 R13: 0000000000000003 R14: 0000000000760150 R15: 000000000075bf2c netlink: 4 bytes leftover after parsing attributes in process `syz-executor.0'. ttyprintk ttyprintk: tty_port_close_start: tty->count = 1 port count = 2 ttyprintk ttyprintk: tty_port_close_start: tty->count = 1 port count = 2 [U] ^C [U] nla_parse: 2 callbacks suppressed netlink: 256 bytes leftover after parsing attributes in process `syz-executor.4'. [U] ^C [U] ^C [U] [U] [U] ^ [U] ^Z [U] ^\ [U] ^ [U] ^ [U] ^Z IPVS: set_ctl: invalid protocol: 137 127.0.0.1:20004 [U] ^\ [U] ^Z [U] ^\ audit: type=1804 audit(1580946621.025:212): pid=10265 uid=0 auid=4294967295 ses=4294967295 subj=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 op=invalid_pcr cause=open_writers comm="syz-executor.4" name="/root/syzkaller-testdir690658694/syzkaller.HRJwz9/4120/bus" dev="sda1" ino=16557 res=1 audit: type=1800 audit(1580946621.035:213): pid=10265 uid=0 auid=4294967295 ses=4294967295 subj=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 op=collect_data cause=failed(directio) comm="syz-executor.4" name="bus" dev="sda1" ino=16557 res=0 [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R netlink: 4 bytes leftover after parsing attributes in process `syz-executor.0'. [U] ^R [U] ^R [U] ^R netlink: 4 bytes leftover after parsing attributes in process `syz-executor.0'. [U] ^R netlink: 4 bytes leftover after parsing attributes in process `syz-executor.0'. [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R Enabling of bearer rejected, illegal name [U] ^R [U] ^R [U] ^R Unknown ioctl 21544 [U] ^R [U] ^R [U] ^R [U] ^R [U] ^R