syzbot


possible deadlock in tty_port_tty_get (2)

Status: fixed on 2024/05/22 23:36
Subsystems: bpf net
[Documentation on labels]
Reported-by: syzbot+afcf1c450aca9ec1b5f1@syzkaller.appspotmail.com
Fix commit: ff9105993240 bpf, sockmap: Prevent lock inversion deadlock in map delete elem
First crash: 263d, last: 241d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [bpf?] [net?] possible deadlock in tty_port_tty_get (2) 1 (2) 2024/04/20 14:03
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in tty_port_tty_get serial C 22661 596d 797d 22/28 fixed on 2023/06/08 14:41
linux-4.14 possible deadlock in tty_port_tty_get 5 659d 838d 0/1 upstream: reported on 2022/08/20 20:12

Sample crash report:
=====================================================
WARNING: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected
6.8.0-syzkaller-08951-gfe46a7dd189e #0 Not tainted
-----------------------------------------------------
syz-executor.2/6263 [HC0[0]:SC0[2]:HE0:SE0] is trying to acquire:
ffff88802a2bb820 (&htab->buckets[i].lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:356 [inline]
ffff88802a2bb820 (&htab->buckets[i].lock){+.-.}-{2:2}, at: sock_hash_delete_elem+0xcb/0x260 net/core/sock_map.c:939

and this task is already holding:
ffff88807d879958 (&port->lock){-.-.}-{2:2}, at: tty_insert_flip_string_and_push_buffer+0x7f/0x1f0 drivers/tty/tty_buffer.c:557
which would create a new lock dependency:
 (&port->lock){-.-.}-{2:2} -> (&htab->buckets[i].lock){+.-.}-{2:2}

but this new dependency connects a HARDIRQ-irq-safe lock:
 (&port->lock){-.-.}-{2:2}

... which became HARDIRQ-irq-safe at:
  lock_acquire kernel/locking/lockdep.c:5754 [inline]
  lock_acquire+0x1b1/0x540 kernel/locking/lockdep.c:5719
  __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
  _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162
  tty_port_tty_get+0x21/0x100 drivers/tty/tty_port.c:327
  tty_port_default_wakeup+0x15/0x40 drivers/tty/tty_port.c:66
  serial8250_tx_chars+0x55a/0x8b0 drivers/tty/serial/8250/8250_port.c:1835
  serial8250_handle_irq+0x5d3/0x780 drivers/tty/serial/8250/8250_port.c:1942
  serial8250_default_handle_irq+0x9a/0x210 drivers/tty/serial/8250/8250_port.c:1962
  serial8250_interrupt+0x103/0x210 drivers/tty/serial/8250/8250_core.c:127
  __handle_irq_event_percpu+0x229/0x750 kernel/irq/handle.c:158
  handle_irq_event_percpu kernel/irq/handle.c:193 [inline]
  handle_irq_event+0xab/0x1e0 kernel/irq/handle.c:210
  handle_edge_irq+0x263/0xd10 kernel/irq/chip.c:831
  generic_handle_irq_desc include/linux/irqdesc.h:161 [inline]
  handle_irq arch/x86/kernel/irq.c:238 [inline]
  __common_interrupt+0xde/0x250 arch/x86/kernel/irq.c:257
  common_interrupt+0xab/0xd0 arch/x86/kernel/irq.c:247
  asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693
  __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
  _raw_spin_unlock_irqrestore+0x31/0x80 kernel/locking/spinlock.c:194
  spin_unlock_irqrestore include/linux/spinlock.h:406 [inline]
  uart_port_unlock_irqrestore include/linux/serial_core.h:667 [inline]
  serial_port_runtime_resume+0x2b7/0x340 drivers/tty/serial/serial_port.c:41
  __rpm_callback+0xc5/0x4c0 drivers/base/power/runtime.c:394
  rpm_callback+0x1da/0x220 drivers/base/power/runtime.c:448
  rpm_resume+0xcf9/0x12f0 drivers/base/power/runtime.c:914
  pm_runtime_work+0x10c/0x150 drivers/base/power/runtime.c:979
  process_one_work+0x9a9/0x1a60 kernel/workqueue.c:3254
  process_scheduled_works kernel/workqueue.c:3335 [inline]
  worker_thread+0x6c8/0xf70 kernel/workqueue.c:3416
  kthread+0x2c1/0x3a0 kernel/kthread.c:388
  ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243

to a HARDIRQ-irq-unsafe lock:
 (&htab->buckets[i].lock){+.-.}-{2:2}

... which became HARDIRQ-irq-unsafe at:
...
  lock_acquire kernel/locking/lockdep.c:5754 [inline]
  lock_acquire+0x1b1/0x540 kernel/locking/lockdep.c:5719
  __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline]
  _raw_spin_lock_bh+0x33/0x40 kernel/locking/spinlock.c:178
  spin_lock_bh include/linux/spinlock.h:356 [inline]
  sock_hash_update_common+0x1fe/0xa60 net/core/sock_map.c:1007
  sock_map_update_elem_sys+0x280/0x570 net/core/sock_map.c:581
  bpf_map_update_value+0x36c/0x6c0 kernel/bpf/syscall.c:172
  map_update_elem+0x623/0x910 kernel/bpf/syscall.c:1641
  __sys_bpf+0xab9/0x4b40 kernel/bpf/syscall.c:5619
  __do_sys_bpf kernel/bpf/syscall.c:5738 [inline]
  __se_sys_bpf kernel/bpf/syscall.c:5736 [inline]
  __x64_sys_bpf+0x78/0xc0 kernel/bpf/syscall.c:5736
  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
  do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83
  entry_SYSCALL_64_after_hwframe+0x6d/0x75

other info that might help us debug this:

 Possible interrupt unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&htab->buckets[i].lock);
                               local_irq_disable();
                               lock(&port->lock);
                               lock(&htab->buckets[i].lock);
  <Interrupt>
    lock(&port->lock);

 *** DEADLOCK ***

6 locks held by syz-executor.2/6263:
 #0: ffff888058ae30a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref_wait+0x24/0x80 drivers/tty/tty_ldisc.c:243
 #1: ffff888058ae3130 (&tty->atomic_write_lock){+.+.}-{3:3}, at: tty_write_lock drivers/tty/tty_io.c:954 [inline]
 #1: ffff888058ae3130 (&tty->atomic_write_lock){+.+.}-{3:3}, at: iterate_tty_write drivers/tty/tty_io.c:973 [inline]
 #1: ffff888058ae3130 (&tty->atomic_write_lock){+.+.}-{3:3}, at: file_tty_write.constprop.0+0x293/0x9b0 drivers/tty/tty_io.c:1096
 #2: ffff888058ae32e8 (&tty->termios_rwsem){++++}-{3:3}, at: n_tty_write+0xd88/0x1150 drivers/tty/n_tty.c:2423
 #3: ffffc900020c8380 (&ldata->output_lock){+.+.}-{3:3}, at: n_tty_write+0xaf7/0x1150 drivers/tty/n_tty.c:2400
 #4: ffff88807d879958 (&port->lock){-.-.}-{2:2}, at: tty_insert_flip_string_and_push_buffer+0x7f/0x1f0 drivers/tty/tty_buffer.c:557
 #5: ffffffff8d7b08e0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:298 [inline]
 #5: ffffffff8d7b08e0 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:750 [inline]
 #5: ffffffff8d7b08e0 (rcu_read_lock){....}-{1:2}, at: __bpf_trace_run kernel/trace/bpf_trace.c:2380 [inline]
 #5: ffffffff8d7b08e0 (rcu_read_lock){....}-{1:2}, at: bpf_trace_run4+0x107/0x460 kernel/trace/bpf_trace.c:2422

the dependencies between HARDIRQ-irq-safe lock and the holding lock:
-> (&port->lock){-.-.}-{2:2} {
   IN-HARDIRQ-W at:
                    lock_acquire kernel/locking/lockdep.c:5754 [inline]
                    lock_acquire+0x1b1/0x540 kernel/locking/lockdep.c:5719
                    __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
                    _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162
                    tty_port_tty_get+0x21/0x100 drivers/tty/tty_port.c:327
                    tty_port_default_wakeup+0x15/0x40 drivers/tty/tty_port.c:66
                    serial8250_tx_chars+0x55a/0x8b0 drivers/tty/serial/8250/8250_port.c:1835
                    serial8250_handle_irq+0x5d3/0x780 drivers/tty/serial/8250/8250_port.c:1942
                    serial8250_default_handle_irq+0x9a/0x210 drivers/tty/serial/8250/8250_port.c:1962
                    serial8250_interrupt+0x103/0x210 drivers/tty/serial/8250/8250_core.c:127
                    __handle_irq_event_percpu+0x229/0x750 kernel/irq/handle.c:158
                    handle_irq_event_percpu kernel/irq/handle.c:193 [inline]
                    handle_irq_event+0xab/0x1e0 kernel/irq/handle.c:210
                    handle_edge_irq+0x263/0xd10 kernel/irq/chip.c:831
                    generic_handle_irq_desc include/linux/irqdesc.h:161 [inline]
                    handle_irq arch/x86/kernel/irq.c:238 [inline]
                    __common_interrupt+0xde/0x250 arch/x86/kernel/irq.c:257
                    common_interrupt+0xab/0xd0 arch/x86/kernel/irq.c:247
                    asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693
                    __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
                    _raw_spin_unlock_irqrestore+0x31/0x80 kernel/locking/spinlock.c:194
                    spin_unlock_irqrestore include/linux/spinlock.h:406 [inline]
                    uart_port_unlock_irqrestore include/linux/serial_core.h:667 [inline]
                    serial_port_runtime_resume+0x2b7/0x340 drivers/tty/serial/serial_port.c:41
                    __rpm_callback+0xc5/0x4c0 drivers/base/power/runtime.c:394
                    rpm_callback+0x1da/0x220 drivers/base/power/runtime.c:448
                    rpm_resume+0xcf9/0x12f0 drivers/base/power/runtime.c:914
                    pm_runtime_work+0x10c/0x150 drivers/base/power/runtime.c:979
                    process_one_work+0x9a9/0x1a60 kernel/workqueue.c:3254
                    process_scheduled_works kernel/workqueue.c:3335 [inline]
                    worker_thread+0x6c8/0xf70 kernel/workqueue.c:3416
                    kthread+0x2c1/0x3a0 kernel/kthread.c:388
                    ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
                    ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243
   IN-SOFTIRQ-W at:
                    lock_acquire kernel/locking/lockdep.c:5754 [inline]
                    lock_acquire+0x1b1/0x540 kernel/locking/lockdep.c:5719
                    __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
                    _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162
                    tty_port_tty_get+0x21/0x100 drivers/tty/tty_port.c:327
                    tty_port_default_wakeup+0x15/0x40 drivers/tty/tty_port.c:66
                    serial8250_tx_chars+0x55a/0x8b0 drivers/tty/serial/8250/8250_port.c:1835
                    serial8250_handle_irq+0x5d3/0x780 drivers/tty/serial/8250/8250_port.c:1942
                    serial8250_default_handle_irq+0x9a/0x210 drivers/tty/serial/8250/8250_port.c:1962
                    serial8250_interrupt+0x103/0x210 drivers/tty/serial/8250/8250_core.c:127
                    __handle_irq_event_percpu+0x229/0x750 kernel/irq/handle.c:158
                    handle_irq_event_percpu kernel/irq/handle.c:193 [inline]
                    handle_irq_event+0xab/0x1e0 kernel/irq/handle.c:210
                    handle_edge_irq+0x263/0xd10 kernel/irq/chip.c:831
                    generic_handle_irq_desc include/linux/irqdesc.h:161 [inline]
                    handle_irq arch/x86/kernel/irq.c:238 [inline]
                    __common_interrupt+0xde/0x250 arch/x86/kernel/irq.c:257
                    common_interrupt+0x52/0xd0 arch/x86/kernel/irq.c:247
                    asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693
                    variable_ffs arch/x86/include/asm/bitops.h:321 [inline]
                    __do_softirq+0x1dc/0x8de kernel/softirq.c:542
                    invoke_softirq kernel/softirq.c:428 [inline]
                    __irq_exit_rcu kernel/softirq.c:633 [inline]
                    irq_exit_rcu+0xb9/0x120 kernel/softirq.c:645
                    instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline]
                    sysvec_apic_timer_interrupt+0x95/0xb0 arch/x86/kernel/apic/apic.c:1043
                    asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
                    __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
                    _raw_spin_unlock_irqrestore+0x31/0x80 kernel/locking/spinlock.c:194
                    spin_unlock_irqrestore include/linux/spinlock.h:406 [inline]
                    uart_port_unlock_irqrestore include/linux/serial_core.h:667 [inline]
                    serial_port_runtime_resume+0x2b7/0x340 drivers/tty/serial/serial_port.c:41
                    __rpm_callback+0xc5/0x4c0 drivers/base/power/runtime.c:394
                    rpm_callback+0x1da/0x220 drivers/base/power/runtime.c:448
                    rpm_resume+0xcf9/0x12f0 drivers/base/power/runtime.c:914
                    pm_runtime_work+0x10c/0x150 drivers/base/power/runtime.c:979
                    process_one_work+0x9a9/0x1a60 kernel/workqueue.c:3254
                    process_scheduled_works kernel/workqueue.c:3335 [inline]
                    worker_thread+0x6c8/0xf70 kernel/workqueue.c:3416
                    kthread+0x2c1/0x3a0 kernel/kthread.c:388
                    ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
                    ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243
   INITIAL USE at:
                   lock_acquire kernel/locking/lockdep.c:5754 [inline]
                   lock_acquire+0x1b1/0x540 kernel/locking/lockdep.c:5719
                   __raw_spin_lock_irq include/linux/spinlock_api_smp.h:119 [inline]
                   _raw_spin_lock_irq+0x36/0x50 kernel/locking/spinlock.c:170
                   spin_lock_irq include/linux/spinlock.h:376 [inline]
                   tty_port_open+0x2b/0x1f0 drivers/tty/tty_port.c:768
                   uart_open+0x41/0x60 drivers/tty/serial/serial_core.c:1982
                   tty_open+0x3fc/0x1020 drivers/tty/tty_io.c:2152
                   chrdev_open+0x26d/0x6f0 fs/char_dev.c:414
                   do_dentry_open+0x8da/0x18c0 fs/open.c:955
                   do_open fs/namei.c:3642 [inline]
                   path_openat+0x1dfb/0x2990 fs/namei.c:3799
                   do_filp_open+0x1dc/0x430 fs/namei.c:3826
                   file_open_name+0x2a4/0x450 fs/open.c:1351
                   filp_open+0x4b/0x80 fs/open.c:1371
                   console_on_rootfs+0x1d/0x80 init/main.c:1508
                   kernel_init_freeable+0x6f5/0xc40 init/main.c:1555
                   kernel_init+0x1c/0x2a0 init/main.c:1439
                   ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
                   ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243
 }
 ... key      at: [<ffffffff949131c0>] __key.1+0x0/0x40

the dependencies between the lock to be acquired
 and HARDIRQ-irq-unsafe lock:
-> (&htab->buckets[i].lock){+.-.}-{2:2} {
   HARDIRQ-ON-W at:
                    lock_acquire kernel/locking/lockdep.c:5754 [inline]
                    lock_acquire+0x1b1/0x540 kernel/locking/lockdep.c:5719
                    __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline]
                    _raw_spin_lock_bh+0x33/0x40 kernel/locking/spinlock.c:178
                    spin_lock_bh include/linux/spinlock.h:356 [inline]
                    sock_hash_update_common+0x1fe/0xa60 net/core/sock_map.c:1007
                    sock_map_update_elem_sys+0x280/0x570 net/core/sock_map.c:581
                    bpf_map_update_value+0x36c/0x6c0 kernel/bpf/syscall.c:172
                    map_update_elem+0x623/0x910 kernel/bpf/syscall.c:1641
                    __sys_bpf+0xab9/0x4b40 kernel/bpf/syscall.c:5619
                    __do_sys_bpf kernel/bpf/syscall.c:5738 [inline]
                    __se_sys_bpf kernel/bpf/syscall.c:5736 [inline]
                    __x64_sys_bpf+0x78/0xc0 kernel/bpf/syscall.c:5736
                    do_syscall_x64 arch/x86/entry/common.c:52 [inline]
                    do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83
                    entry_SYSCALL_64_after_hwframe+0x6d/0x75
   IN-SOFTIRQ-W at:
                    lock_acquire kernel/locking/lockdep.c:5754 [inline]
                    lock_acquire+0x1b1/0x540 kernel/locking/lockdep.c:5719
                    __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline]
                    _raw_spin_lock_bh+0x33/0x40 kernel/locking/spinlock.c:178
                    spin_lock_bh include/linux/spinlock.h:356 [inline]
                    sock_hash_delete_elem+0xcb/0x260 net/core/sock_map.c:939
                    ___bpf_prog_run+0x3e51/0xae80 kernel/bpf/core.c:1997
                    __bpf_prog_run32+0xc1/0x100 kernel/bpf/core.c:2236
                    bpf_dispatcher_nop_func include/linux/bpf.h:1234 [inline]
                    __bpf_prog_run include/linux/filter.h:657 [inline]
                    bpf_prog_run include/linux/filter.h:664 [inline]
                    __bpf_trace_run kernel/trace/bpf_trace.c:2381 [inline]
                    bpf_trace_run4+0x176/0x460 kernel/trace/bpf_trace.c:2422
                    trace_mm_page_alloc include/trace/events/kmem.h:177 [inline]
                    __alloc_pages+0x3ad/0x2410 mm/page_alloc.c:4591
                    __alloc_pages_node include/linux/gfp.h:238 [inline]
                    alloc_pages_node include/linux/gfp.h:261 [inline]
                    page_frag_alloc_1k net/core/skbuff.c:250 [inline]
                    __napi_alloc_skb+0x4d8/0x6f0 net/core/skbuff.c:834
                    napi_alloc_skb include/linux/skbuff.h:3363 [inline]
                    page_to_skb+0x150/0xb00 drivers/net/virtio_net.c:569
                    receive_mergeable drivers/net/virtio_net.c:1683 [inline]
                    receive_buf+0x118d/0x51f0 drivers/net/virtio_net.c:1804
                    virtnet_receive drivers/net/virtio_net.c:2110 [inline]
                    virtnet_poll+0xa0b/0x1840 drivers/net/virtio_net.c:2203
                    __napi_poll.constprop.0+0xb7/0x550 net/core/dev.c:6632
                    napi_poll net/core/dev.c:6701 [inline]
                    net_rx_action+0x9ad/0xf10 net/core/dev.c:6813
                    __do_softirq+0x218/0x8de kernel/softirq.c:554
                    invoke_softirq kernel/softirq.c:428 [inline]
                    __irq_exit_rcu kernel/softirq.c:633 [inline]
                    irq_exit_rcu+0xb9/0x120 kernel/softirq.c:645
                    common_interrupt+0xb0/0xd0 arch/x86/kernel/irq.c:247
                    asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693
                    unwind_next_frame+0x5fb/0x23a0 arch/x86/kernel/unwind_orc.c:505
                    __unwind_start+0x5aa/0x880 arch/x86/kernel/unwind_orc.c:760
                    unwind_start arch/x86/include/asm/unwind.h:64 [inline]
                    arch_stack_walk+0xb2/0x170 arch/x86/kernel/stacktrace.c:24
                    stack_trace_save+0x95/0xd0 kernel/stacktrace.c:122
                    kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
                    kasan_save_track+0x14/0x30 mm/kasan/common.c:68
                    unpoison_slab_object mm/kasan/common.c:312 [inline]
                    __kasan_slab_alloc+0x89/0x90 mm/kasan/common.c:338
                    kasan_slab_alloc include/linux/kasan.h:201 [inline]
                    slab_post_alloc_hook mm/slub.c:3798 [inline]
                    slab_alloc_node mm/slub.c:3845 [inline]
                    kmem_cache_alloc+0x136/0x320 mm/slub.c:3852
                    kmem_cache_zalloc include/linux/slab.h:739 [inline]
                    alloc_empty_file+0x73/0x1e0 fs/file_table.c:202
                    path_openat+0xdb/0x2990 fs/namei.c:3785
                    do_filp_open+0x1dc/0x430 fs/namei.c:3826
                    do_sys_openat2+0x17a/0x1e0 fs/open.c:1406
                    do_sys_open fs/open.c:1421 [inline]
                    __do_sys_openat fs/open.c:1437 [inline]
                    __se_sys_openat fs/open.c:1432 [inline]
                    __x64_sys_openat+0x175/0x210 fs/open.c:1432
                    do_syscall_x64 arch/x86/entry/common.c:52 [inline]
                    do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83
                    entry_SYSCALL_64_after_hwframe+0x6d/0x75
   INITIAL USE at:
                   lock_acquire kernel/locking/lockdep.c:5754 [inline]
                   lock_acquire+0x1b1/0x540 kernel/locking/lockdep.c:5719
                   __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline]
                   _raw_spin_lock_bh+0x33/0x40 kernel/locking/spinlock.c:178
                   spin_lock_bh include/linux/spinlock.h:356 [inline]
                   sock_hash_update_common+0x1fe/0xa60 net/core/sock_map.c:1007
                   sock_map_update_elem_sys+0x280/0x570 net/core/sock_map.c:581
                   bpf_map_update_value+0x36c/0x6c0 kernel/bpf/syscall.c:172
                   map_update_elem+0x623/0x910 kernel/bpf/syscall.c:1641
                   __sys_bpf+0xab9/0x4b40 kernel/bpf/syscall.c:5619
                   __do_sys_bpf kernel/bpf/syscall.c:5738 [inline]
                   __se_sys_bpf kernel/bpf/syscall.c:5736 [inline]
                   __x64_sys_bpf+0x78/0xc0 kernel/bpf/syscall.c:5736
                   do_syscall_x64 arch/x86/entry/common.c:52 [inline]
                   do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83
                   entry_SYSCALL_64_after_hwframe+0x6d/0x75
 }
 ... key      at: [<ffffffff949c67c0>] __key.0+0x0/0x40
 ... acquired at:
   lock_acquire kernel/locking/lockdep.c:5754 [inline]
   lock_acquire+0x1b1/0x540 kernel/locking/lockdep.c:5719
   __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline]
   _raw_spin_lock_bh+0x33/0x40 kernel/locking/spinlock.c:178
   spin_lock_bh include/linux/spinlock.h:356 [inline]
   sock_hash_delete_elem+0xcb/0x260 net/core/sock_map.c:939
   ___bpf_prog_run+0x3e51/0xae80 kernel/bpf/core.c:1997
   __bpf_prog_run32+0xc1/0x100 kernel/bpf/core.c:2236
   bpf_dispatcher_nop_func include/linux/bpf.h:1234 [inline]
   __bpf_prog_run include/linux/filter.h:657 [inline]
   bpf_prog_run include/linux/filter.h:664 [inline]
   __bpf_trace_run kernel/trace/bpf_trace.c:2381 [inline]
   bpf_trace_run4+0x176/0x460 kernel/trace/bpf_trace.c:2422
   trace_mm_page_alloc include/trace/events/kmem.h:177 [inline]
   __alloc_pages+0x3ad/0x2410 mm/page_alloc.c:4591
   __alloc_pages_node include/linux/gfp.h:238 [inline]
   alloc_pages_node include/linux/gfp.h:261 [inline]
   alloc_slab_page mm/slub.c:2175 [inline]
   allocate_slab mm/slub.c:2338 [inline]
   new_slab+0xcc/0x3a0 mm/slub.c:2391
   ___slab_alloc+0x66d/0x1790 mm/slub.c:3525
   __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3610
   __slab_alloc_node mm/slub.c:3663 [inline]
   slab_alloc_node mm/slub.c:3835 [inline]
   __do_kmalloc_node mm/slub.c:3965 [inline]
   __kmalloc+0x3b4/0x440 mm/slub.c:3979
   kmalloc include/linux/slab.h:632 [inline]
   tty_buffer_alloc+0x297/0x3d0 drivers/tty/tty_buffer.c:179
   __tty_buffer_request_room+0x12e/0x2d0 drivers/tty/tty_buffer.c:272
   __tty_insert_flip_string_flags+0xd7/0x400 drivers/tty/tty_buffer.c:308
   tty_insert_flip_string_fixed_flag include/linux/tty_flip.h:35 [inline]
   tty_insert_flip_string include/linux/tty_flip.h:83 [inline]
   tty_insert_flip_string_and_push_buffer+0x9d/0x1f0 drivers/tty/tty_buffer.c:558
   pty_write+0xd2/0x100 drivers/tty/pty.c:118
   n_tty_write+0xb2b/0x1150 drivers/tty/n_tty.c:2401
   iterate_tty_write drivers/tty/tty_io.c:1021 [inline]
   file_tty_write.constprop.0+0x518/0x9b0 drivers/tty/tty_io.c:1096
   call_write_iter include/linux/fs.h:2108 [inline]
   new_sync_write fs/read_write.c:497 [inline]
   vfs_write+0x6db/0x1100 fs/read_write.c:590
   ksys_write+0x12f/0x260 fs/read_write.c:643
   do_syscall_x64 arch/x86/entry/common.c:52 [inline]
   do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83
   entry_SYSCALL_64_after_hwframe+0x6d/0x75


stack backtrace:
CPU: 0 PID: 6263 Comm: syz-executor.2 Not tainted 6.8.0-syzkaller-08951-gfe46a7dd189e #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114
 print_bad_irq_dependency kernel/locking/lockdep.c:2626 [inline]
 check_irq_usage+0xe3c/0x1490 kernel/locking/lockdep.c:2865
 check_prev_add kernel/locking/lockdep.c:3138 [inline]
 check_prevs_add kernel/locking/lockdep.c:3253 [inline]
 validate_chain kernel/locking/lockdep.c:3869 [inline]
 __lock_acquire+0x248e/0x3b30 kernel/locking/lockdep.c:5137
 lock_acquire kernel/locking/lockdep.c:5754 [inline]
 lock_acquire+0x1b1/0x540 kernel/locking/lockdep.c:5719
 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline]
 _raw_spin_lock_bh+0x33/0x40 kernel/locking/spinlock.c:178
 spin_lock_bh include/linux/spinlock.h:356 [inline]
 sock_hash_delete_elem+0xcb/0x260 net/core/sock_map.c:939
 ___bpf_prog_run+0x3e51/0xae80 kernel/bpf/core.c:1997
 __bpf_prog_run32+0xc1/0x100 kernel/bpf/core.c:2236
 bpf_dispatcher_nop_func include/linux/bpf.h:1234 [inline]
 __bpf_prog_run include/linux/filter.h:657 [inline]
 bpf_prog_run include/linux/filter.h:664 [inline]
 __bpf_trace_run kernel/trace/bpf_trace.c:2381 [inline]
 bpf_trace_run4+0x176/0x460 kernel/trace/bpf_trace.c:2422
 trace_mm_page_alloc include/trace/events/kmem.h:177 [inline]
 __alloc_pages+0x3ad/0x2410 mm/page_alloc.c:4591
 __alloc_pages_node include/linux/gfp.h:238 [inline]
 alloc_pages_node include/linux/gfp.h:261 [inline]
 alloc_slab_page mm/slub.c:2175 [inline]
 allocate_slab mm/slub.c:2338 [inline]
 new_slab+0xcc/0x3a0 mm/slub.c:2391
 ___slab_alloc+0x66d/0x1790 mm/slub.c:3525
 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3610
 __slab_alloc_node mm/slub.c:3663 [inline]
 slab_alloc_node mm/slub.c:3835 [inline]
 __do_kmalloc_node mm/slub.c:3965 [inline]
 __kmalloc+0x3b4/0x440 mm/slub.c:3979
 kmalloc include/linux/slab.h:632 [inline]
 tty_buffer_alloc+0x297/0x3d0 drivers/tty/tty_buffer.c:179
 __tty_buffer_request_room+0x12e/0x2d0 drivers/tty/tty_buffer.c:272
 __tty_insert_flip_string_flags+0xd7/0x400 drivers/tty/tty_buffer.c:308
 tty_insert_flip_string_fixed_flag include/linux/tty_flip.h:35 [inline]
 tty_insert_flip_string include/linux/tty_flip.h:83 [inline]
 tty_insert_flip_string_and_push_buffer+0x9d/0x1f0 drivers/tty/tty_buffer.c:558
 pty_write+0xd2/0x100 drivers/tty/pty.c:118
 n_tty_write+0xb2b/0x1150 drivers/tty/n_tty.c:2401
 iterate_tty_write drivers/tty/tty_io.c:1021 [inline]
 file_tty_write.constprop.0+0x518/0x9b0 drivers/tty/tty_io.c:1096
 call_write_iter include/linux/fs.h:2108 [inline]
 new_sync_write fs/read_write.c:497 [inline]
 vfs_write+0x6db/0x1100 fs/read_write.c:590
 ksys_write+0x12f/0x260 fs/read_write.c:643
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x6d/0x75
RIP: 0033:0x7f112ba7de69
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 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 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f112c7a40c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f112bbabf80 RCX: 00007f112ba7de69
RDX: 000000000000ff2e RSI: 00000000200000c0 RDI: 0000000000000003
RBP: 00007f112baca47a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f112bbabf80 R15: 00007ffe53edca98
 </TASK>
------------[ cut here ]------------
raw_local_irq_restore() called with IRQs enabled
WARNING: CPU: 0 PID: 6263 at kernel/locking/irqflag-debug.c:10 warn_bogus_irq_restore+0x29/0x30 kernel/locking/irqflag-debug.c:10
Modules linked in:
CPU: 0 PID: 6263 Comm: syz-executor.2 Not tainted 6.8.0-syzkaller-08951-gfe46a7dd189e #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
RIP: 0010:warn_bogus_irq_restore+0x29/0x30 kernel/locking/irqflag-debug.c:10
Code: 90 f3 0f 1e fa 90 80 3d 72 d0 b5 04 00 74 06 90 c3 cc cc cc cc c6 05 63 d0 b5 04 01 90 48 c7 c7 c0 b1 0c 8b e8 78 6b 7d f6 90 <0f> 0b 90 90 eb df 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
RSP: 0018:ffffc900038afa50 EFLAGS: 00010286
RAX: 0000000000000000 RBX: ffff88807d879940 RCX: ffffc90009d61000
RDX: 0000000000040000 RSI: ffffffff814faff6 RDI: 0000000000000001
RBP: 0000000000000283 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000001 R12: 1ffff92000715f4f
R13: 0000000000000283 R14: ffff88807d879940 R15: ffff888069510000
FS:  00007f112c7a46c0(0000) GS:ffff8880b9400000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b30522000 CR3: 00000000534e8000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
 _raw_spin_unlock_irqrestore+0x74/0x80 kernel/locking/spinlock.c:194
 spin_unlock_irqrestore include/linux/spinlock.h:406 [inline]
 tty_insert_flip_string_and_push_buffer+0x143/0x1f0 drivers/tty/tty_buffer.c:561
 pty_write+0xd2/0x100 drivers/tty/pty.c:118
 n_tty_write+0xb2b/0x1150 drivers/tty/n_tty.c:2401
 iterate_tty_write drivers/tty/tty_io.c:1021 [inline]
 file_tty_write.constprop.0+0x518/0x9b0 drivers/tty/tty_io.c:1096
 call_write_iter include/linux/fs.h:2108 [inline]
 new_sync_write fs/read_write.c:497 [inline]
 vfs_write+0x6db/0x1100 fs/read_write.c:590
 ksys_write+0x12f/0x260 fs/read_write.c:643
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x6d/0x75
RIP: 0033:0x7f112ba7de69
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 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 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f112c7a40c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f112bbabf80 RCX: 00007f112ba7de69
RDX: 000000000000ff2e RSI: 00000000200000c0 RDI: 0000000000000003
RBP: 00007f112baca47a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f112bbabf80 R15: 00007ffe53edca98
 </TASK>

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/09 18:08 upstream fe46a7dd189e 56086b24 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in tty_port_tty_get
2024/03/18 04:39 upstream fe46a7dd189e d615901c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in tty_port_tty_get
2024/04/03 11:21 upstream 3e92c1e6cd87 9d2a90af .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in tty_port_tty_get
* Struck through repros no longer work on HEAD.