syzbot


possible deadlock in tty_port_close_start

Status: auto-obsoleted due to no activity on 2022/10/02 01:37
Reported-by: syzbot+044000e5acdb5e1d5eed@syzkaller.appspotmail.com
First crash: 963d, last: 368d

Cause bisection: the cause commit could be any of (bisect log):
  9211bfbff80a netfilter: add missing IS_ENABLED(CONFIG_BRIDGE_NETFILTER) checks to header-file.
  47e640af2e49 netfilter: add missing IS_ENABLED(CONFIG_NF_TABLES) check to header-file.
  a1b2f04ea527 netfilter: add missing includes to a number of header-files.
  0abc8bf4f284 netfilter: add missing IS_ENABLED(CONFIG_NF_CONNTRACK) checks to some header-files.
  bd96b4c75675 netfilter: inline four headers files into another one.
  43dd16efc7f2 netfilter: nf_tables: store data in offload context registers
  78458e3e08cd netfilter: add missing IS_ENABLED(CONFIG_NETFILTER) checks to some header-files.
  20a9379d9a03 netfilter: remove "#ifdef __KERNEL__" guards from some headers.
  bd8699e9e292 netfilter: nft_bitwise: add offload support
  2a475c409fe8 kbuild: remove all netfilter headers from header-test blacklist.
  7e59b3fea2a2 netfilter: remove unnecessary spaces
  1b90af292e71 ipvs: Improve robustness to the ipvs sysctl
  5785cf15fd74 netfilter: nf_tables: add missing prototypes.
  0a30ba509fde netfilter: nf_nat_proto: make tables static
  e84fb4b3666d netfilter: conntrack: use shared sysctl constants
  105333435b4f netfilter: connlabels: prefer static lock initialiser
  8c0bb7873815 netfilter: synproxy: rename mss synproxy_options field
  c162610c7db2 Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next

Fix bisection: failed (bisect log)
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 possible deadlock in tty_port_close_start C done 47 505d 970d 1/1 fixed on 2021/06/15 21:27
linux-4.14 possible deadlock in tty_port_close_start C 49 27d 961d 0/1 upstream: reported C repro on 2020/02/15 19:33
Patch testing requests:
Created Duration User Patch Repo Result
2022/10/02 00:30 18m upstream OK log
2022/10/01 23:30 18m upstream OK log
2022/08/31 02:27 18m upstream OK log

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.11.0-rc7-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor895/9972 is trying to acquire lock:
ffffffff8bc82ca0 (console_owner){....}-{0:0}, at: console_trylock_spinning kernel/printk/printk.c:1778 [inline]
ffffffff8bc82ca0 (console_owner){....}-{0:0}, at: vprintk_emit+0x282/0x490 kernel/printk/printk.c:2091

but task is already holding lock:
ffffffff906974f8 (&port->lock){-.-.}-{2:2}, at: tty_port_close_start.part.0+0x28/0x550 drivers/tty/tty_port.c:567

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&port->lock){-.-.}-{2:2}:
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:159
       tty_port_tty_get+0x1f/0x100 drivers/tty/tty_port.c:288
       tty_port_default_wakeup+0x11/0x40 drivers/tty/tty_port.c:47
       serial8250_tx_chars+0x487/0xa80 drivers/tty/serial/8250/8250_port.c:1832
       serial8250_handle_irq.part.0+0x328/0x3d0 drivers/tty/serial/8250/8250_port.c:1919
       serial8250_handle_irq drivers/tty/serial/8250/8250_port.c:1892 [inline]
       serial8250_default_handle_irq+0xb2/0x220 drivers/tty/serial/8250/8250_port.c:1935
       serial8250_interrupt+0xfd/0x200 drivers/tty/serial/8250/8250_core.c:126
       __handle_irq_event_percpu+0x303/0x8f0 kernel/irq/handle.c:156
       handle_irq_event_percpu kernel/irq/handle.c:196 [inline]
       handle_irq_event+0x102/0x290 kernel/irq/handle.c:213
       handle_edge_irq+0x25f/0xd00 kernel/irq/chip.c:819
       asm_call_irq_on_stack+0xf/0x20
       __run_irq_on_irqstack arch/x86/include/asm/irq_stack.h:48 [inline]
       run_irq_on_irqstack_cond arch/x86/include/asm/irq_stack.h:101 [inline]
       handle_irq arch/x86/kernel/irq.c:230 [inline]
       __common_interrupt arch/x86/kernel/irq.c:249 [inline]
       common_interrupt+0x120/0x200 arch/x86/kernel/irq.c:239
       asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:620
       native_restore_fl arch/x86/include/asm/irqflags.h:41 [inline]
       arch_local_irq_restore arch/x86/include/asm/irqflags.h:84 [inline]
       __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline]
       _raw_spin_unlock_irqrestore+0x25/0x50 kernel/locking/spinlock.c:191
       spin_unlock_irqrestore include/linux/spinlock.h:409 [inline]
       uart_write+0x30d/0x570 drivers/tty/serial/serial_core.c:615
       do_output_char+0x5de/0x850 drivers/tty/n_tty.c:448
       process_output drivers/tty/n_tty.c:515 [inline]
       n_tty_write+0x4c3/0xfd0 drivers/tty/n_tty.c:2344
       do_tty_write drivers/tty/tty_io.c:961 [inline]
       file_tty_write.constprop.0+0x521/0x8f0 drivers/tty/tty_io.c:1048
       redirected_tty_write+0xa1/0xc0 drivers/tty/tty_io.c:1055
       call_write_iter include/linux/fs.h:1901 [inline]
       do_iter_readv_writev+0x46f/0x740 fs/read_write.c:740
       do_iter_write+0x188/0x670 fs/read_write.c:866
       vfs_writev+0x1aa/0x620 fs/read_write.c:939
       do_writev+0x139/0x300 fs/read_write.c:982
       do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xa9

-> #1 (&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:159
       serial8250_console_write+0x880/0xa90 drivers/tty/serial/8250/8250_port.c:3292
       call_console_drivers kernel/printk/printk.c:1856 [inline]
       console_unlock+0x841/0xbb0 kernel/printk/printk.c:2570
       vprintk_emit+0x189/0x490 kernel/printk/printk.c:2092
       vprintk_func+0x8d/0x1e0 kernel/printk/printk_safe.c:393
       printk+0xba/0xed kernel/printk/printk.c:2140
       register_console kernel/printk/printk.c:2921 [inline]
       register_console+0x5d1/0x800 kernel/printk/printk.c:2801
       univ8250_console_init+0x3a/0x46 drivers/tty/serial/8250/8250_core.c:690
       console_init+0x3c7/0x596 kernel/printk/printk.c:3021
       start_kernel+0x2fc/0x48c init/main.c:989
       secondary_startup_64_no_verify+0xb0/0xbb

-> #0 (console_owner){....}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:2868 [inline]
       check_prevs_add kernel/locking/lockdep.c:2993 [inline]
       validate_chain kernel/locking/lockdep.c:3608 [inline]
       __lock_acquire+0x2b26/0x54f0 kernel/locking/lockdep.c:4832
       lock_acquire kernel/locking/lockdep.c:5442 [inline]
       lock_acquire+0x1a8/0x720 kernel/locking/lockdep.c:5407
       console_trylock_spinning kernel/printk/printk.c:1799 [inline]
       vprintk_emit+0x2bf/0x490 kernel/printk/printk.c:2091
       vprintk_func+0x8d/0x1e0 kernel/printk/printk_safe.c:393
       printk+0xba/0xed kernel/printk/printk.c:2140
       tty_port_close_start.part.0+0x503/0x550 drivers/tty/tty_port.c:569
       tty_port_close_start drivers/tty/tty_port.c:641 [inline]
       tty_port_close+0x46/0x170 drivers/tty/tty_port.c:634
       tty_release+0x45e/0x1210 drivers/tty/tty_io.c:1694
       __fput+0x283/0x920 fs/file_table.c:280
       task_work_run+0xdd/0x190 kernel/task_work.c:140
       tracehook_notify_resume include/linux/tracehook.h:189 [inline]
       exit_to_user_mode_loop kernel/entry/common.c:174 [inline]
       exit_to_user_mode_prepare+0x249/0x250 kernel/entry/common.c:201
       __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline]
       syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294
       entry_SYSCALL_64_after_hwframe+0x44/0xa9

other info that might help us debug this:

Chain exists of:
  console_owner --> &port_lock_key --> &port->lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&port->lock);
                               lock(&port_lock_key);
                               lock(&port->lock);
  lock(console_owner);

 *** DEADLOCK ***

2 locks held by syz-executor895/9972:
 #0: ffff8880196361c0 (&tty->legacy_mutex){+.+.}-{3:3}, at: tty_lock+0xbd/0x120 drivers/tty/tty_mutex.c:19
 #1: ffffffff906974f8 (&port->lock){-.-.}-{2:2}, at: tty_port_close_start.part.0+0x28/0x550 drivers/tty/tty_port.c:567

stack backtrace:
CPU: 1 PID: 9972 Comm: syz-executor895 Not tainted 5.11.0-rc7-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x107/0x163 lib/dump_stack.c:120
 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2117
 check_prev_add kernel/locking/lockdep.c:2868 [inline]
 check_prevs_add kernel/locking/lockdep.c:2993 [inline]
 validate_chain kernel/locking/lockdep.c:3608 [inline]
 __lock_acquire+0x2b26/0x54f0 kernel/locking/lockdep.c:4832
 lock_acquire kernel/locking/lockdep.c:5442 [inline]
 lock_acquire+0x1a8/0x720 kernel/locking/lockdep.c:5407
 console_trylock_spinning kernel/printk/printk.c:1799 [inline]
 vprintk_emit+0x2bf/0x490 kernel/printk/printk.c:2091
 vprintk_func+0x8d/0x1e0 kernel/printk/printk_safe.c:393
 printk+0xba/0xed kernel/printk/printk.c:2140
 tty_port_close_start.part.0+0x503/0x550 drivers/tty/tty_port.c:569
 tty_port_close_start drivers/tty/tty_port.c:641 [inline]
 tty_port_close+0x46/0x170 drivers/tty/tty_port.c:634
 tty_release+0x45e/0x1210 drivers/tty/tty_io.c:1694
 __fput+0x283/0x920 fs/file_table.c:280
 task_work_run+0xdd/0x190 kernel/task_work.c:140
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:174 [inline]
 exit_to_user_mode_prepare+0x249/0x250 kernel/entry/common.c:201
 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline]
 syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x40a51b
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:00007ffeb88b7090 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000004 RCX: 000000000040a51b
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00000000000129ac R08: 0000000000000000 R09: 00007ffe00000001
R10: 0000000000000000 R11: 0000000000000293 R12: 00000000004d04fc
R13: 00007ffeb88b72e0 R14: 00000000004d04e0 R15: 00007ffeb88b7160

Crashes (43):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-root 2021/02/13 06:30 upstream dcc0b49040c7 98682e5e .config log report syz C possible deadlock in tty_port_close_start
ci-qemu-upstream 2020/06/13 18:52 upstream 435faf5c218a dbce178a .config log report syz C
ci-upstream-kasan-gce-root 2020/02/17 14:42 upstream 11a48a5a18c6 2b411596 .config log report syz C
ci-upstream-kasan-gce-selinux-root 2021/04/23 22:43 upstream 18a3c5f7abfd 17f0b706 .config log report info possible deadlock in tty_port_close_start
ci-upstream-kasan-gce-root 2021/04/06 05:16 upstream 0a50438c8436 6a81331a .config log report info possible deadlock in tty_port_close_start
ci-upstream-kasan-gce-selinux-root 2021/03/27 19:53 upstream 0f4498cef9f5 a8529b82 .config log report info possible deadlock in tty_port_close_start
ci-upstream-kasan-gce-selinux-root 2021/03/24 04:02 upstream 7acac4b3196c e613994b .config log report info possible deadlock in tty_port_close_start
ci-upstream-kasan-gce-root 2021/03/22 00:27 upstream 5ee96fa9dd78 bea32f74 .config log report info possible deadlock in tty_port_close_start
ci-upstream-kasan-gce-root 2021/03/14 03:54 upstream 88fe49249c99 4a003785 .config log report info possible deadlock in tty_port_close_start
ci-upstream-kasan-gce-root 2021/03/10 05:50 upstream 144c79ef3353 26967e35 .config log report info possible deadlock in tty_port_close_start
ci-qemu-upstream 2021/03/07 09:34 upstream 280d542f6ffa c599ed12 .config log report info possible deadlock in tty_port_close_start
ci-upstream-kasan-gce-selinux-root 2021/03/02 09:07 upstream fe07bfda2fb9 183afb6c .config log report info possible deadlock in tty_port_close_start
ci-qemu-upstream 2021/02/27 15:02 upstream 3fb6d0e00efc 4c37c133 .config log report info possible deadlock in tty_port_close_start
ci-qemu-upstream 2021/02/20 21:46 upstream f40ddce88593 3e5ed8b4 .config log report info possible deadlock in tty_port_close_start
ci-qemu-upstream 2021/02/19 02:00 upstream f40ddce88593 14052202 .config log report info possible deadlock in tty_port_close_start
ci-qemu-upstream 2021/02/15 01:34 upstream f40ddce88593 98682e5e .config log report info possible deadlock in tty_port_close_start
ci-qemu-upstream 2021/02/03 16:58 upstream 3aaf0a27ffc2 624dad51 .config log report info possible deadlock in tty_port_close_start
ci-upstream-kasan-gce-root 2021/01/19 10:41 upstream 1e2a199f6ccd 63631df1 .config log report info possible deadlock in tty_port_close_start
ci-qemu2-arm32 2021/09/30 02:19 upstream bf152b0b41dc be530f6c .config log report info possible deadlock in tty_port_close_start
ci-qemu2-arm64 2021/04/03 09:08 upstream 0a84c2e440f7 6a81331a .config log report info possible deadlock in tty_port_close_start
ci-qemu-upstream-386 2021/02/09 03:08 upstream e0756cfc7d7c 2bd9619f .config log report info possible deadlock in tty_port_close_start
ci-upstream-linux-next-kasan-gce-root 2021/04/06 08:14 linux-next 454c576c3f5e 6a81331a .config log report info possible deadlock in tty_port_close_start
ci-upstream-linux-next-kasan-gce-root 2021/03/31 12:22 linux-next 931294922e65 6a81331a .config log report info possible deadlock in tty_port_close_start
ci-upstream-kasan-gce-root 2021/01/12 15:26 upstream a0d54b4f5b21 2c1f2513 .config log report info
ci-upstream-kasan-gce-root 2021/01/12 07:05 upstream a0d54b4f5b21 2c1f2513 .config log report info
ci-upstream-kasan-gce-root 2021/01/11 15:48 upstream 7c53f6b671f4 2c1f2513 .config log report info
ci-upstream-kasan-gce-root 2021/01/11 06:45 upstream 0653161f0fac 2c1f2513 .config log report info
ci-upstream-kasan-gce-root 2021/01/03 04:18 upstream 3516bd729358 79264ae3 .config log report info
ci-upstream-kasan-gce-root 2020/12/03 17:10 upstream 34816d20f173 e6b0d314 .config log report info
ci-upstream-kasan-gce-root 2020/11/17 09:07 upstream 9c87c9f41245 1bf9a662 .config log report info
ci-upstream-kasan-gce-root 2020/09/06 23:37 upstream dd9fb9bb3340 abf9ba4f .config log report
ci-upstream-kasan-gce-selinux-root 2020/08/20 10:50 upstream 7eac66d0456f ed282a3a .config log report
ci-upstream-kasan-gce-root 2020/07/28 02:35 upstream 92ed30191993 cb93dc6a .config log report
ci-upstream-kasan-gce-root 2020/06/18 05:18 upstream 7ae77150d94d b9f3810b .config log report
ci-upstream-kasan-gce-root 2020/06/02 03:38 upstream 9bf9511e3d9f a0331e89 .config log report
ci-upstream-kasan-gce-selinux-root 2020/05/30 19:59 upstream 86852175b016 6f3e1c7c .config log report
ci-upstream-kasan-gce-root 2020/03/27 14:14 upstream f3e69428b5e2 7d95711b .config log report
ci-upstream-kasan-gce-root 2020/02/28 13:35 upstream f8788d86ab28 59b57593 .config log report
ci-upstream-kasan-gce-root 2020/02/12 23:17 upstream f2850dd5ee01 84f4fc8a .config log report
ci-upstream-linux-next-kasan-gce-root 2020/12/04 21:07 linux-next 0eedceafd3a6 20366b87 .config log report info
ci-upstream-linux-next-kasan-gce-root 2020/09/01 01:50 linux-next b36c969764ab d5a3ae1f .config log report
ci-upstream-linux-next-kasan-gce-root 2020/08/12 12:40 linux-next bc09acc9f224 bb3e5fe6 .config log report
ci-upstream-linux-next-kasan-gce-root 2020/02/20 00:52 linux-next 1d7f85df0f9c b690a6e3 .config log report
* Struck through repros no longer work on HEAD.