audit: type=1804 audit(1612726590.474:230): pid=21401 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.2" name="/root/syzkaller-testdir897772570/syzkaller.e8deWn/1169/file0" dev="sda1" ino=17814 res=1 audit: type=1804 audit(1612726590.504:231): pid=21401 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.2" name="/root/syzkaller-testdir897772570/syzkaller.e8deWn/1169/file0" dev="sda1" ino=17814 res=1 ttyprintk ttyprintk: tty_port_close_start: tty->count = 1 port count = 3 ====================================================== WARNING: possible circular locking dependency detected 4.19.172-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.5/21409 is trying to acquire lock: 0000000054fe848d (console_owner){-.-.}, at: console_trylock_spinning syzkaller/managers/linux-4-19/kernel/kernel/printk/printk.c:1697 [inline] 0000000054fe848d (console_owner){-.-.}, at: vprintk_emit+0x3fe/0x740 syzkaller/managers/linux-4-19/kernel/kernel/printk/printk.c:1964 but task is already holding lock: 000000005b96160a (&(&port->lock)->rlock){-.-.}, at: tty_port_close_start.part.0+0x28/0x540 syzkaller/managers/linux-4-19/kernel/drivers/tty/tty_port.c:574 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&(&port->lock)->rlock){-.-.}: tty_port_tty_get+0x1d/0x80 syzkaller/managers/linux-4-19/kernel/drivers/tty/tty_port.c:289 tty_port_default_wakeup+0x11/0x40 syzkaller/managers/linux-4-19/kernel/drivers/tty/tty_port.c:47 serial8250_tx_chars+0x490/0xaf0 syzkaller/managers/linux-4-19/kernel/drivers/tty/serial/8250/8250_port.c:1806 serial8250_handle_irq.part.0+0x31f/0x3d0 syzkaller/managers/linux-4-19/kernel/drivers/tty/serial/8250/8250_port.c:1893 serial8250_handle_irq syzkaller/managers/linux-4-19/kernel/drivers/tty/serial/8250/8250_port.c:1866 [inline] serial8250_default_handle_irq+0xae/0x220 syzkaller/managers/linux-4-19/kernel/drivers/tty/serial/8250/8250_port.c:1909 serial8250_interrupt+0x101/0x240 syzkaller/managers/linux-4-19/kernel/drivers/tty/serial/8250/8250_core.c:125 __handle_irq_event_percpu+0x27e/0x8e0 syzkaller/managers/linux-4-19/kernel/kernel/irq/handle.c:149 handle_irq_event_percpu syzkaller/managers/linux-4-19/kernel/kernel/irq/handle.c:189 [inline] handle_irq_event+0x102/0x290 syzkaller/managers/linux-4-19/kernel/kernel/irq/handle.c:206 handle_edge_irq+0x260/0xcf0 syzkaller/managers/linux-4-19/kernel/kernel/irq/chip.c:797 generic_handle_irq_desc syzkaller/managers/linux-4-19/kernel/./include/linux/irqdesc.h:155 [inline] handle_irq+0x35/0x50 syzkaller/managers/linux-4-19/kernel/arch/x86/kernel/irq_64.c:87 do_IRQ+0x93/0x1c0 syzkaller/managers/linux-4-19/kernel/arch/x86/kernel/irq.c:246 ret_from_intr+0x0/0x1e native_safe_halt+0xe/0x10 syzkaller/managers/linux-4-19/kernel/./arch/x86/include/asm/irqflags.h:60 arch_safe_halt syzkaller/managers/linux-4-19/kernel/./arch/x86/include/asm/paravirt.h:94 [inline] default_idle+0x49/0x310 syzkaller/managers/linux-4-19/kernel/arch/x86/kernel/process.c:557 cpuidle_idle_call syzkaller/managers/linux-4-19/kernel/kernel/sched/idle.c:153 [inline] do_idle+0x2ec/0x4b0 syzkaller/managers/linux-4-19/kernel/kernel/sched/idle.c:263 cpu_startup_entry+0xc5/0xe0 syzkaller/managers/linux-4-19/kernel/kernel/sched/idle.c:369 start_kernel+0x8d6/0x911 syzkaller/managers/linux-4-19/kernel/init/main.c:736 secondary_startup_64+0xa4/0xb0 syzkaller/managers/linux-4-19/kernel/arch/x86/kernel/head_64.S:243 -> #1 (&port_lock_key){-.-.}: serial8250_console_write+0x89b/0xad0 syzkaller/managers/linux-4-19/kernel/drivers/tty/serial/8250/8250_port.c:3270 call_console_drivers syzkaller/managers/linux-4-19/kernel/kernel/printk/printk.c:1764 [inline] console_unlock+0xbb6/0x1110 syzkaller/managers/linux-4-19/kernel/kernel/printk/printk.c:2460 vprintk_emit+0x2d1/0x740 syzkaller/managers/linux-4-19/kernel/kernel/printk/printk.c:1965 vprintk_func+0x79/0x180 syzkaller/managers/linux-4-19/kernel/kernel/printk/printk_safe.c:397 printk+0xba/0xed syzkaller/managers/linux-4-19/kernel/kernel/printk/printk.c:2040 register_console+0x87f/0xc90 syzkaller/managers/linux-4-19/kernel/kernel/printk/printk.c:2776 univ8250_console_init+0x3a/0x46 syzkaller/managers/linux-4-19/kernel/drivers/tty/serial/8250/8250_core.c:684 console_init+0x4cb/0x718 syzkaller/managers/linux-4-19/kernel/kernel/printk/printk.c:2862 start_kernel+0x686/0x911 syzkaller/managers/linux-4-19/kernel/init/main.c:659 secondary_startup_64+0xa4/0xb0 syzkaller/managers/linux-4-19/kernel/arch/x86/kernel/head_64.S:243 -> #0 (console_owner){-.-.}: console_trylock_spinning syzkaller/managers/linux-4-19/kernel/kernel/printk/printk.c:1718 [inline] vprintk_emit+0x43b/0x740 syzkaller/managers/linux-4-19/kernel/kernel/printk/printk.c:1964 vprintk_func+0x79/0x180 syzkaller/managers/linux-4-19/kernel/kernel/printk/printk_safe.c:397 printk+0xba/0xed syzkaller/managers/linux-4-19/kernel/kernel/printk/printk.c:2040 tty_port_close_start.part.0+0x4f3/0x540 syzkaller/managers/linux-4-19/kernel/drivers/tty/tty_port.c:576 tty_port_close_start syzkaller/managers/linux-4-19/kernel/drivers/tty/tty_port.c:648 [inline] tty_port_close+0x46/0x160 syzkaller/managers/linux-4-19/kernel/drivers/tty/tty_port.c:641 tty_release+0x45e/0x1210 syzkaller/managers/linux-4-19/kernel/drivers/tty/tty_io.c:1678 __fput+0x2ce/0x890 syzkaller/managers/linux-4-19/kernel/fs/file_table.c:278 task_work_run+0x148/0x1c0 syzkaller/managers/linux-4-19/kernel/kernel/task_work.c:113 tracehook_notify_resume syzkaller/managers/linux-4-19/kernel/./include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x251/0x2a0 syzkaller/managers/linux-4-19/kernel/arch/x86/entry/common.c:167 prepare_exit_to_usermode syzkaller/managers/linux-4-19/kernel/arch/x86/entry/common.c:198 [inline] syscall_return_slowpath syzkaller/managers/linux-4-19/kernel/arch/x86/entry/common.c:271 [inline] do_syscall_64+0x538/0x620 syzkaller/managers/linux-4-19/kernel/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.5/21409: #0: 00000000acab2723 (&tty->legacy_mutex){+.+.}, at: tty_lock+0x6a/0xa0 syzkaller/managers/linux-4-19/kernel/drivers/tty/tty_mutex.c:19 #1: 000000005b96160a (&(&port->lock)->rlock){-.-.}, at: tty_port_close_start.part.0+0x28/0x540 syzkaller/managers/linux-4-19/kernel/drivers/tty/tty_port.c:574 stack backtrace: CPU: 1 PID: 21409 Comm: syz-executor.5 Not tainted 4.19.172-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack syzkaller/managers/linux-4-19/kernel/lib/dump_stack.c:77 [inline] dump_stack+0x1fc/0x2ef syzkaller/managers/linux-4-19/kernel/lib/dump_stack.c:118 print_circular_bug.constprop.0.cold+0x2d7/0x41e syzkaller/managers/linux-4-19/kernel/kernel/locking/lockdep.c:1221 check_prev_add syzkaller/managers/linux-4-19/kernel/kernel/locking/lockdep.c:1865 [inline] check_prevs_add syzkaller/managers/linux-4-19/kernel/kernel/locking/lockdep.c:1978 [inline] validate_chain syzkaller/managers/linux-4-19/kernel/kernel/locking/lockdep.c:2419 [inline] __lock_acquire+0x30c9/0x3ff0 syzkaller/managers/linux-4-19/kernel/kernel/locking/lockdep.c:3415 lock_acquire+0x170/0x3c0 syzkaller/managers/linux-4-19/kernel/kernel/locking/lockdep.c:3907 console_trylock_spinning syzkaller/managers/linux-4-19/kernel/kernel/printk/printk.c:1718 [inline] vprintk_emit+0x43b/0x740 syzkaller/managers/linux-4-19/kernel/kernel/printk/printk.c:1964 vprintk_func+0x79/0x180 syzkaller/managers/linux-4-19/kernel/kernel/printk/printk_safe.c:397 printk+0xba/0xed syzkaller/managers/linux-4-19/kernel/kernel/printk/printk.c:2040 tty_port_close_start.part.0+0x4f3/0x540 syzkaller/managers/linux-4-19/kernel/drivers/tty/tty_port.c:576 tty_port_close_start syzkaller/managers/linux-4-19/kernel/drivers/tty/tty_port.c:648 [inline] tty_port_close+0x46/0x160 syzkaller/managers/linux-4-19/kernel/drivers/tty/tty_port.c:641 tty_release+0x45e/0x1210 syzkaller/managers/linux-4-19/kernel/drivers/tty/tty_io.c:1678 __fput+0x2ce/0x890 syzkaller/managers/linux-4-19/kernel/fs/file_table.c:278 task_work_run+0x148/0x1c0 syzkaller/managers/linux-4-19/kernel/kernel/task_work.c:113 tracehook_notify_resume syzkaller/managers/linux-4-19/kernel/./include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x251/0x2a0 syzkaller/managers/linux-4-19/kernel/arch/x86/entry/common.c:167 prepare_exit_to_usermode syzkaller/managers/linux-4-19/kernel/arch/x86/entry/common.c:198 [inline] syscall_return_slowpath syzkaller/managers/linux-4-19/kernel/arch/x86/entry/common.c:271 [inline] do_syscall_64+0x538/0x620 syzkaller/managers/linux-4-19/kernel/arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x418e1b Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44 RSP: 002b:00007ffcae90d510 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000418e1b RDX: 00000000000f4240 RSI: 0000000000570148 RDI: 0000000000000003 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 00000000005680c0 R11: 0000000000000293 R12: 0000000000570148 R13: 00000000000ea0be R14: 000000000056bf60 R15: 000000000056bf60 audit: type=1804 audit(1612726590.504:232): pid=21401 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.2" name="/root/syzkaller-testdir897772570/syzkaller.e8deWn/1169/file0" dev="sda1" ino=17814 res=1 input: syz1 as /devices/virtual/input/input1918 input: syz1 as /devices/virtual/input/input1919 input: syz1 as /devices/virtual/input/input1920 input: syz1 as /devices/virtual/input/input1921 input: syz1 as /devices/virtual/input/input1922 input: syz1 as /devices/virtual/input/input1923 input: syz1 as /devices/virtual/input/input1924 input: syz1 as /devices/virtual/input/input1925 input: syz1 as /devices/virtual/input/input1928 audit: type=1804 audit(1612726592.774:233): pid=21666 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.2" name="/root/syzkaller-testdir897772570/syzkaller.e8deWn/1176/file0" dev="sda1" ino=15939 res=1 audit: type=1804 audit(1612726592.814:234): pid=21666 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.2" name="/root/syzkaller-testdir897772570/syzkaller.e8deWn/1176/file0" dev="sda1" ino=15939 res=1 [U] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2 input: syz1 as /devices/virtual/input/input1934 input: syz1 as /devices/virtual/input/input1935 [U] ^C [U] ^C input: syz1 as /devices/virtual/input/input1936 input: syz1 as /devices/virtual/input/input1937 [U] ^C [U] ^C input: syz1 as /devices/virtual/input/input1938 input: syz1 as /devices/virtual/input/input1939 [U] ^C [U] ^C input: syz1 as /devices/virtual/input/input1940 [U] ^C input: syz1 as /devices/virtual/input/input1941 [U] ^C uinput: write device info first uinput: write device info first uinput: write device info first uinput: write device info first [U] ^C [U] ^C input: syz1 as /devices/virtual/input/input1946 input: syz1 as /devices/virtual/input/input1947 [U] ^C [U] ^C sd 0:0:1:0: PR command failed: 134217730 sd 0:0:1:0: Sense Key : Illegal Request [current] [U] ^C sd 0:0:1:0: Add. Sense: Invalid command operation code uinput: write device info first uinput: write device info first [U] ^C [U] ^C [U] ^C [U] ^C input: syz1 as /devices/virtual/input/input1950 input: syz1 as /devices/virtual/input/input1951 [U] ^C input: syz1 as /devices/virtual/input/input1952 input: syz1 as /devices/virtual/input/input1953 [U] ^C audit: type=1804 audit(1612726595.304:235): pid=22090 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.5" name="/root/syzkaller-testdir965468930/syzkaller.LQRg7Q/1908/bus" dev="sda1" ino=15827 res=1 [U] ^C input: syz1 as /devices/virtual/input/input1954 [U] ^C input: syz1 as /devices/virtual/input/input1955 [U] ^C input: syz1 as /devices/virtual/input/input1956 input: syz1 as /devices/virtual/input/input1957 input: syz0 as /devices/virtual/input/input1958 input: syz0 as /devices/virtual/input/input1959 input: syz1 as /devices/virtual/input/input1960 [U] ^C input: syz1 as /devices/virtual/input/input1961 [U] ^C [U] ^C [U] ^C input: syz1 as /devices/virtual/input/input1962 input: syz1 as /devices/virtual/input/input1963 9pnet: p9_fd_create_unix (22291): problem connecting socket: éq‰Y’3aK: -111 9pnet: p9_fd_create_unix (22303): problem connecting socket: éq‰Y’3aK: -111 input: syz1 as /devices/virtual/input/input1964 [U] ^C input: syz1 as /devices/virtual/input/input1965 [U] ^C [U] ^C [U] ^C input: syz1 as /devices/virtual/input/input1966 input: syz1 as /devices/virtual/input/input1968 input: syz1 as /devices/virtual/input/input1970 [U] ^C input: syz1 as /devices/virtual/input/input1971 [U] ^C [U] ^C input: syz1 as /devices/virtual/input/input1972 input: syz1 as /devices/virtual/input/input1973 input: syz1 as /devices/virtual/input/input1974 input: syz1 as /devices/virtual/input/input1975 input: syz1 as /devices/virtual/input/input1976 input: syz1 as /devices/virtual/input/input1977 audit: type=1804 audit(1612726597.864:236): pid=22514 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.2" name="/root/syzkaller-testdir897772570/syzkaller.e8deWn/1198/file0" dev="sda1" ino=16609 res=1 [U] ^C [U] ^C [U] ^C input: syz1 as /devices/virtual/input/input1978 input: syz1 as /devices/virtual/input/input1980 squashfs: SQUASHFS error: Can't find a SQUASHFS superblock on loop5 [U] ^C input: syz1 as /devices/virtual/input/input1981 [U] ^C [U] ^C input: syz1 as /devices/virtual/input/input1982 overlayfs: unrecognized mount option "sm>ckfsdef=^/" or missing value input: syz1 as /devices/virtual/input/input1983 [U] ^C [U] ^C input: syz0 as /devices/virtual/input/input1984 input: syz0 as /devices/virtual/input/input1985 [U] ^C [U] ^C input: syz1 as /devices/virtual/input/input1986 [U] ^C input: syz1 as /devices/virtual/input/input1988 input: syz1 as /devices/virtual/input/input1990 [U] ^C input: syz1 as /devices/virtual/input/input1991 [U] ^C input: syz1 as /devices/virtual/input/input1992 [U] ^C input: syz1 as /devices/virtual/input/input1993 [U] ^C uinput: write device info first [U] ^C input: syz1 as /devices/virtual/input/input1994 [U] ^C uinput: write device info first input: syz1 as /devices/virtual/input/input1995 [U] ^C input: syz1 as /devices/virtual/input/input1996 [U] ^C