syzbot


possible deadlock in vprintk_emit

Status: upstream: reported C repro on 2019/04/16 05:43
Reported-by: syzbot+4afd53f5cc81c8427bda@syzkaller.appspotmail.com
First crash: 2033d, last: 1624d
Fix bisection the fix commit could be any of (bisect log):
  1ec8f1f0bffe Linux 4.14.111
  4139fb08c05f Linux 4.14.187
  
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-414 possible deadlock in vprintk_emit 5 2050d 2036d 0/1 auto-closed as invalid on 2019/09/26 04:13
android-414 possible deadlock in vprintk_emit (2) 1 1845d 1845d 0/1 auto-closed as invalid on 2020/02/18 18:06
upstream possible deadlock in vprintk_emit serial C 1433 1747d 2345d 0/28 closed as dup on 2018/06/08 07:50
linux-4.19 possible deadlock in vprintk_emit C error 172 1143d 2037d 0/1 upstream: reported C repro on 2019/04/11 22:47
Last patch testing requests (2)
Created Duration User Patch Repo Result
2022/12/30 11:31 10m retest repro linux-4.14.y report log
2022/08/31 23:27 13m retest repro linux-4.14.y report log
Fix bisection attempts (5)
Created Duration User Patch Repo Result
2020/06/28 07:12 29m (3) bisect fix linux-4.14.y OK (2) job log
2020/05/29 06:48 23m bisect fix linux-4.14.y OK (0) job log log
2020/04/29 05:33 23m bisect fix linux-4.14.y OK (0) job log log
2020/03/30 05:10 23m bisect fix linux-4.14.y OK (0) job log log
2020/02/29 04:29 25m bisect fix linux-4.14.y OK (0) job log log

Sample crash report:
RDX: 0000000020000040 RSI: 0000000000005412 RDI: 0000000000000004
RBP: 0000000000000005 R08: 0000000000000001 R09: 00000000000000c2
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000401f40
R13: 0000000000401fd0 R14: 0000000000000000 R15: 0000000000000000
======================================================
WARNING: possible circular locking dependency detected
4.14.111 #1 Not tainted
------------------------------------------------------
syz-executor206/7038 is trying to acquire lock:
 (console_owner){-...}, at: [<ffffffff814af951>] console_trylock_spinning kernel/printk/printk.c:1652 [inline]
 (console_owner){-...}, at: [<ffffffff814af951>] vprintk_emit kernel/printk/printk.c:1916 [inline]
 (console_owner){-...}, at: [<ffffffff814af951>] vprintk_emit+0x2f1/0x600 kernel/printk/printk.c:1882

but task is already holding lock:
 (&(&port->lock)->rlock){-.-.}, at: [<ffffffff8311ed60>] pty_write+0xe0/0x1d0 drivers/tty/pty.c:119

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&(&port->lock)->rlock){-.-.}:
       lock_acquire+0x16f/0x430 kernel/locking/lockdep.c:3994
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x95/0xcd kernel/locking/spinlock.c:160
       tty_port_tty_get+0x22/0x80 drivers/tty/tty_port.c:287
       tty_port_default_wakeup+0x16/0x40 drivers/tty/tty_port.c:46
       tty_port_tty_wakeup+0x5d/0x70 drivers/tty/tty_port.c:389
       uart_write_wakeup+0x46/0x70 drivers/tty/serial/serial_core.c:116
       serial8250_tx_chars+0x41c/0xa30 drivers/tty/serial/8250/8250_port.c:1810
       serial8250_handle_irq.part.0+0x198/0x220 drivers/tty/serial/8250/8250_port.c:1883
       serial8250_handle_irq drivers/tty/serial/8250/8250_port.c:1869 [inline]
       serial8250_default_handle_irq+0xa6/0x120 drivers/tty/serial/8250/8250_port.c:1899
       serial8250_interrupt+0xef/0x1a0 drivers/tty/serial/8250/8250_core.c:129
       __handle_irq_event_percpu+0x127/0x800 kernel/irq/handle.c:147
       handle_irq_event_percpu+0x65/0x130 kernel/irq/handle.c:187
       handle_irq_event+0xa7/0x134 kernel/irq/handle.c:204
       handle_edge_irq+0x231/0x850 kernel/irq/chip.c:770
       generic_handle_irq_desc include/linux/irqdesc.h:159 [inline]
       handle_irq+0x252/0x34c arch/x86/kernel/irq_64.c:78
       do_IRQ+0x99/0x1e0 arch/x86/kernel/irq.c:230
       ret_from_intr+0x0/0x1e
       native_safe_halt+0x2/0x10 arch/x86/include/asm/irqflags.h:57
       arch_cpu_idle+0x10/0x20 arch/x86/kernel/process.c:555
       default_idle_call+0x36/0x90 kernel/sched/idle.c:98
       cpuidle_idle_call kernel/sched/idle.c:156 [inline]
       do_idle+0x262/0x3d0 kernel/sched/idle.c:246
       cpu_startup_entry+0x1b/0x20 kernel/sched/idle.c:351
       rest_init+0xf1/0xf6 init/main.c:435
       start_kernel+0x6e2/0x700 init/main.c:709
       x86_64_start_reservations+0x29/0x2b arch/x86/kernel/head64.c:380
       x86_64_start_kernel+0x77/0x7b arch/x86/kernel/head64.c:361
       secondary_startup_64+0xa5/0xb0 arch/x86/kernel/head_64.S:240

-> #1 (&port_lock_key){-.-.}:
       lock_acquire+0x16f/0x430 kernel/locking/lockdep.c:3994
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x95/0xcd kernel/locking/spinlock.c:160
       serial8250_console_write+0x72c/0x950 drivers/tty/serial/8250/8250_port.c:3232
       univ8250_console_write+0x5f/0x70 drivers/tty/serial/8250/8250_core.c:597
       call_console_drivers kernel/printk/printk.c:1719 [inline]
       console_unlock+0x9c1/0xed0 kernel/printk/printk.c:2391
       vprintk_emit kernel/printk/printk.c:1917 [inline]
       vprintk_emit+0x1f9/0x600 kernel/printk/printk.c:1882
       vprintk_default+0x28/0x30 kernel/printk/printk.c:1957
       vprintk_func+0x5d/0x159 kernel/printk/printk_safe.c:401
       printk+0x9e/0xbc kernel/printk/printk.c:1990
       register_console+0x61c/0x9f0 kernel/printk/printk.c:2710
       univ8250_console_init+0x33/0x3f drivers/tty/serial/8250/8250_core.c:692
       console_init+0x54/0x60 kernel/printk/printk.c:2791
       start_kernel+0x43f/0x700 init/main.c:635
       x86_64_start_reservations+0x29/0x2b arch/x86/kernel/head64.c:380
       x86_64_start_kernel+0x77/0x7b arch/x86/kernel/head64.c:361
       secondary_startup_64+0xa5/0xb0 arch/x86/kernel/head_64.S:240

-> #0 (console_owner){-...}:
       check_prev_add kernel/locking/lockdep.c:1901 [inline]
       check_prevs_add kernel/locking/lockdep.c:2018 [inline]
       validate_chain kernel/locking/lockdep.c:2460 [inline]
       __lock_acquire+0x2c89/0x45e0 kernel/locking/lockdep.c:3487
       lock_acquire+0x16f/0x430 kernel/locking/lockdep.c:3994
       console_trylock_spinning kernel/printk/printk.c:1673 [inline]
       vprintk_emit kernel/printk/printk.c:1916 [inline]
       vprintk_emit+0x32e/0x600 kernel/printk/printk.c:1882
       vprintk_default+0x28/0x30 kernel/printk/printk.c:1957
       vprintk_func+0x5d/0x159 kernel/printk/printk_safe.c:401
       printk+0x9e/0xbc kernel/printk/printk.c:1990
       fail_dump lib/fault-inject.c:44 [inline]
       should_fail.cold+0xe4/0x159 lib/fault-inject.c:149
       should_failslab+0xdb/0x130 mm/failslab.c:32
       slab_pre_alloc_hook mm/slab.h:421 [inline]
       slab_alloc mm/slab.c:3376 [inline]
       __do_kmalloc mm/slab.c:3718 [inline]
       __kmalloc+0x71/0x7a0 mm/slab.c:3729
       kmalloc include/linux/slab.h:493 [inline]
       tty_buffer_alloc drivers/tty/tty_buffer.c:169 [inline]
       __tty_buffer_request_room+0x1a4/0x500 drivers/tty/tty_buffer.c:267
       tty_insert_flip_string_fixed_flag+0x8a/0x1c0 drivers/tty/tty_buffer.c:312
       tty_insert_flip_string include/linux/tty_flip.h:37 [inline]
       pty_write+0x113/0x1d0 drivers/tty/pty.c:121
       tty_put_char+0x113/0x140 drivers/tty/tty_io.c:2878
       __process_echoes+0x2ce/0x8a0 drivers/tty/n_tty.c:708
       flush_echoes drivers/tty/n_tty.c:829 [inline]
       __receive_buf drivers/tty/n_tty.c:1648 [inline]
       n_tty_receive_buf_common+0x998/0x2410 drivers/tty/n_tty.c:1742
       n_tty_receive_buf+0x31/0x3b drivers/tty/n_tty.c:1771
       tiocsti drivers/tty/tty_io.c:2184 [inline]
       tty_ioctl+0xe0e/0x1340 drivers/tty/tty_io.c:2570
       vfs_ioctl fs/ioctl.c:46 [inline]
       file_ioctl fs/ioctl.c:500 [inline]
       do_vfs_ioctl+0x7b9/0x1070 fs/ioctl.c:684
       SYSC_ioctl fs/ioctl.c:701 [inline]
       SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
       do_syscall_64+0x1eb/0x630 arch/x86/entry/common.c:289
       entry_SYSCALL_64_after_hwframe+0x42/0xb7

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 ***

4 locks held by syz-executor206/7038:
 #0:  (&tty->ldisc_sem){++++}, at: [<ffffffff861a89e3>] ldsem_down_read+0x33/0x40 drivers/tty/tty_ldsem.c:377
 #1:  (&o_tty->termios_rwsem/1){++++}, at: [<ffffffff8310dd32>] n_tty_receive_buf_common+0x92/0x2410 drivers/tty/n_tty.c:1705
 #2:  (&ldata->output_lock){+.+.}, at: [<ffffffff8310e5f8>] flush_echoes drivers/tty/n_tty.c:827 [inline]
 #2:  (&ldata->output_lock){+.+.}, at: [<ffffffff8310e5f8>] __receive_buf drivers/tty/n_tty.c:1648 [inline]
 #2:  (&ldata->output_lock){+.+.}, at: [<ffffffff8310e5f8>] n_tty_receive_buf_common+0x958/0x2410 drivers/tty/n_tty.c:1742
 #3:  (&(&port->lock)->rlock){-.-.}, at: [<ffffffff8311ed60>] pty_write+0xe0/0x1d0 drivers/tty/pty.c:119

stack backtrace:
CPU: 1 PID: 7038 Comm: syz-executor206 Not tainted 4.14.111 #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x138/0x19c lib/dump_stack.c:53
 print_circular_bug.isra.0.cold+0x1cc/0x28f kernel/locking/lockdep.c:1258
 check_prev_add kernel/locking/lockdep.c:1901 [inline]
 check_prevs_add kernel/locking/lockdep.c:2018 [inline]
 validate_chain kernel/locking/lockdep.c:2460 [inline]
 __lock_acquire+0x2c89/0x45e0 kernel/locking/lockdep.c:3487
 lock_acquire+0x16f/0x430 kernel/locking/lockdep.c:3994
 console_trylock_spinning kernel/printk/printk.c:1673 [inline]
 vprintk_emit kernel/printk/printk.c:1916 [inline]
 vprintk_emit+0x32e/0x600 kernel/printk/printk.c:1882
 vprintk_default+0x28/0x30 kernel/printk/printk.c:1957
 vprintk_func+0x5d/0x159 kernel/printk/printk_safe.c:401
 printk+0x9e/0xbc kernel/printk/printk.c:1990
 fail_dump lib/fault-inject.c:44 [inline]
 should_fail.cold+0xe4/0x159 lib/fault-inject.c:149
 should_failslab+0xdb/0x130 mm/failslab.c:32
 slab_pre_alloc_hook mm/slab.h:421 [inline]
 slab_alloc mm/slab.c:3376 [inline]
 __do_kmalloc mm/slab.c:3718 [inline]
 __kmalloc+0x71/0x7a0 mm/slab.c:3729
 kmalloc include/linux/slab.h:493 [inline]
 tty_buffer_alloc drivers/tty/tty_buffer.c:169 [inline]
 __tty_buffer_request_room+0x1a4/0x500 drivers/tty/tty_buffer.c:267
 tty_insert_flip_string_fixed_flag+0x8a/0x1c0 drivers/tty/tty_buffer.c:312
 tty_insert_flip_string include/linux/tty_flip.h:37 [inline]
 pty_write+0x113/0x1d0 drivers/tty/pty.c:121
 tty_put_char+0x113/0x140 drivers/tty/tty_io.c:2878
 __process_echoes+0x2ce/0x8a0 drivers/tty/n_tty.c:708
 flush_echoes drivers/tty/n_tty.c:829 [inline]
 __receive_buf drivers/tty/n_tty.c:1648 [inline]
 n_tty_receive_buf_common+0x998/0x2410 drivers/tty/n_tty.c:1742
 n_tty_receive_buf+0x31/0x3b drivers/tty/n_tty.c:1771
 tiocsti drivers/tty/tty_io.c:2184 [inline]
 tty_ioctl+0xe0e/0x1340 drivers/tty/tty_io.c:2570
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x7b9/0x1070 fs/ioctl.c:684
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
 do_syscall_64+0x1eb/0x630 arch/x86/entry/common.c:289
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x440679
RSP: 002b:00007ffdc3243ad8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010

Crashes (280):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/04/16 04:42 linux-4.14.y 1ec8f1f0bffe 505ab413 .config console log report syz C ci2-linux-4-14
2020/01/30 04:29 linux-4.14.y 9fa690a2a016 5ed23f9a .config console log report ci2-linux-4-14
2020/01/28 12:29 linux-4.14.y 9a95f25269bd 56cd6c9b .config console log report ci2-linux-4-14
2020/01/27 17:00 linux-4.14.y 9a95f25269bd 56cd6c9b .config console log report ci2-linux-4-14
2020/01/27 00:32 linux-4.14.y 8bac50406cca dd56146d .config console log report ci2-linux-4-14
2020/01/26 08:14 linux-4.14.y 8bac50406cca f4e7270e .config console log report ci2-linux-4-14
2020/01/21 09:08 linux-4.14.y c1141b3aab36 8eda0b95 .config console log report ci2-linux-4-14
2020/01/21 03:25 linux-4.14.y c1141b3aab36 8eda0b95 .config console log report ci2-linux-4-14
2020/01/18 08:07 linux-4.14.y c1141b3aab36 3de7aabb .config console log report ci2-linux-4-14
2020/01/14 22:11 linux-4.14.y c04fc6fa5c96 fa12bd3c .config console log report ci2-linux-4-14
2020/01/14 12:26 linux-4.14.y 6d0c334a400d 32881205 .config console log report ci2-linux-4-14
2020/01/14 06:39 linux-4.14.y 6d0c334a400d 32881205 .config console log report ci2-linux-4-14
2020/01/13 22:05 linux-4.14.y 6d0c334a400d 99565c1a .config console log report ci2-linux-4-14
2020/01/13 20:00 linux-4.14.y 6d0c334a400d 99565c1a .config console log report ci2-linux-4-14
2020/01/13 17:07 linux-4.14.y 6d0c334a400d 99565c1a .config console log report ci2-linux-4-14
2020/01/11 18:29 linux-4.14.y b0cdffaa546e 4c04afaa .config console log report ci2-linux-4-14
2020/01/11 09:51 linux-4.14.y b0cdffaa546e 4c04afaa .config console log report ci2-linux-4-14
2020/01/08 18:48 linux-4.14.y 84f5ad468100 ddc3e859 .config console log report ci2-linux-4-14
2019/12/29 11:38 linux-4.14.y e1f7d50ae3a3 af6b8ef8 .config console log report ci2-linux-4-14
2019/12/23 21:48 linux-4.14.y e1f7d50ae3a3 be5c2c81 .config console log report ci2-linux-4-14
2019/12/23 14:15 linux-4.14.y e1f7d50ae3a3 be5c2c81 .config console log report ci2-linux-4-14
2019/12/23 08:28 linux-4.14.y e1f7d50ae3a3 8b967267 .config console log report ci2-linux-4-14
2019/12/22 05:35 linux-4.14.y e1f7d50ae3a3 bc586918 .config console log report ci2-linux-4-14
2019/12/21 15:00 linux-4.14.y e1f7d50ae3a3 bc586918 .config console log report ci2-linux-4-14
2019/12/20 18:58 linux-4.14.y bfb9e5c03076 34011c05 .config console log report ci2-linux-4-14
2019/12/20 07:51 linux-4.14.y bfb9e5c03076 36650b4b .config console log report ci2-linux-4-14
2019/12/19 23:51 linux-4.14.y bfb9e5c03076 36650b4b .config console log report ci2-linux-4-14
2019/12/19 06:21 linux-4.14.y bfb9e5c03076 79b211f7 .config console log report ci2-linux-4-14
2019/12/18 01:38 linux-4.14.y bfb9e5c03076 1af3875f .config console log report ci2-linux-4-14
2019/12/17 19:26 linux-4.14.y a844dc4c5442 1af3875f .config console log report ci2-linux-4-14
2019/12/17 09:18 linux-4.14.y a844dc4c5442 d13d7958 .config console log report ci2-linux-4-14
2019/12/15 22:16 linux-4.14.y a844dc4c5442 eef6e580 .config console log report ci2-linux-4-14
2019/12/15 08:36 linux-4.14.y a844dc4c5442 eef6e580 .config console log report ci2-linux-4-14
2019/12/14 16:48 linux-4.14.y a844dc4c5442 eef6e580 .config console log report ci2-linux-4-14
2019/12/14 00:36 linux-4.14.y a844dc4c5442 a5c1ab05 .config console log report ci2-linux-4-14
2019/12/13 04:33 linux-4.14.y a844dc4c5442 08003f64 .config console log report ci2-linux-4-14
2019/12/12 15:39 linux-4.14.y a844dc4c5442 d973f528 .config console log report ci2-linux-4-14
2019/12/12 14:06 linux-4.14.y a844dc4c5442 d973f528 .config console log report ci2-linux-4-14
2019/12/10 22:48 linux-4.14.y a844dc4c5442 101194eb .config console log report ci2-linux-4-14
2019/12/10 22:40 linux-4.14.y a844dc4c5442 101194eb .config console log report ci2-linux-4-14
2019/12/09 16:45 linux-4.14.y a844dc4c5442 b31eda3d .config console log report ci2-linux-4-14
2019/12/07 22:45 linux-4.14.y a844dc4c5442 1508f453 .config console log report ci2-linux-4-14
2019/12/07 09:53 linux-4.14.y a844dc4c5442 85f26751 .config console log report ci2-linux-4-14
2019/12/06 19:20 linux-4.14.y a844dc4c5442 85f26751 .config console log report ci2-linux-4-14
2019/12/06 07:59 linux-4.14.y a844dc4c5442 98b4ef2d .config console log report ci2-linux-4-14
2019/12/06 03:04 linux-4.14.y a844dc4c5442 98b4ef2d .config console log report ci2-linux-4-14
2019/12/05 18:21 linux-4.14.y a844dc4c5442 9fd5a512 .config console log report ci2-linux-4-14
2019/12/02 14:51 linux-4.14.y fbc5fe7a54d0 f879db37 .config console log report ci2-linux-4-14
2019/12/02 05:23 linux-4.14.y fbc5fe7a54d0 f879db37 .config console log report ci2-linux-4-14
2019/12/01 05:20 linux-4.14.y 43598c571e7e a76bf83f .config console log report ci2-linux-4-14
2019/11/28 18:17 linux-4.14.y 43598c571e7e 97264cb1 .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.