syzbot


possible deadlock in __inet_inherit_port

Status: fixed on 2023/02/24 13:50
Subsystems: net
[Documentation on labels]
Fix commit: af295e854a4e l2tp: Don't sleep and disable BH under writer-side sk_callback_lock
First crash: 520d, last: 458d
Cause bisection: introduced by (bisect log) :
commit b68777d54fac21fc833ec26ea1a2a84f975ab035
Author: Jakub Sitnicki <jakub@cloudflare.com>
Date: Mon Nov 14 19:16:19 2022 +0000

  l2tp: Serialize access to sk_user_data with sk_callback_lock

Crash: possible deadlock in __inet_inherit_port (log)
Repro: C syz .config
  

Sample crash report:
=====================================================
WARNING: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected
6.1.0-rc5-syzkaller-00144-g84368d882b96 #0 Not tainted
-----------------------------------------------------
syz-executor117/3634 [HC0[0]:SC0[4]:HE1:SE0] is trying to acquire:
ffff888077748fb8 (k-clock-AF_INET){+++.}-{2:2}, at: sock_i_uid+0x1f/0xb0 net/core/sock.c:2542

and this task is already holding:
ffffc9000160c6f0 (&tcp_hashinfo.bhash[i].lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:355 [inline]
ffffc9000160c6f0 (&tcp_hashinfo.bhash[i].lock){+.-.}-{2:2}, at: inet_csk_get_port+0x66a/0x2640 net/ipv4/inet_connection_sock.c:496
which would create a new lock dependency:
 (&tcp_hashinfo.bhash[i].lock){+.-.}-{2:2} -> (k-clock-AF_INET){+++.}-{2:2}

but this new dependency connects a SOFTIRQ-irq-safe lock:
 (&tcp_hashinfo.bhash[i].lock){+.-.}-{2:2}

... which became SOFTIRQ-irq-safe at:
  lock_acquire kernel/locking/lockdep.c:5668 [inline]
  lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
  __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
  _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
  spin_lock include/linux/spinlock.h:350 [inline]
  __inet_inherit_port+0x297/0x14e0 net/ipv4/inet_hashtables.c:229
  tcp_v4_syn_recv_sock+0xb5b/0x14c0 net/ipv4/tcp_ipv4.c:1588
  tcp_check_req+0x632/0x1aa0 net/ipv4/tcp_minisocks.c:786
  tcp_v4_rcv+0x24b4/0x3980 net/ipv4/tcp_ipv4.c:2030
  ip_protocol_deliver_rcu+0x9f/0x7c0 net/ipv4/ip_input.c:205
  ip_local_deliver_finish+0x2ec/0x4c0 net/ipv4/ip_input.c:233
  NF_HOOK include/linux/netfilter.h:302 [inline]
  NF_HOOK include/linux/netfilter.h:296 [inline]
  ip_local_deliver+0x1ae/0x200 net/ipv4/ip_input.c:254
  dst_input include/net/dst.h:455 [inline]
  ip_sublist_rcv_finish+0x9a/0x2c0 net/ipv4/ip_input.c:575
  ip_list_rcv_finish net/ipv4/ip_input.c:625 [inline]
  ip_sublist_rcv+0x533/0x980 net/ipv4/ip_input.c:633
  ip_list_rcv+0x31e/0x470 net/ipv4/ip_input.c:668
  __netif_receive_skb_list_ptype net/core/dev.c:5532 [inline]
  __netif_receive_skb_list_core+0x548/0x8f0 net/core/dev.c:5580
  __netif_receive_skb_list net/core/dev.c:5632 [inline]
  netif_receive_skb_list_internal+0x75f/0xd90 net/core/dev.c:5723
  gro_normal_list include/net/gro.h:433 [inline]
  gro_normal_list include/net/gro.h:429 [inline]
  napi_complete_done+0x1f5/0x890 net/core/dev.c:6064
  virtqueue_napi_complete drivers/net/virtio_net.c:401 [inline]
  virtnet_poll+0xd08/0x1300 drivers/net/virtio_net.c:1678
  __napi_poll+0xb8/0x770 net/core/dev.c:6498
  napi_poll net/core/dev.c:6565 [inline]
  net_rx_action+0xa00/0xde0 net/core/dev.c:6676
  __do_softirq+0x1fb/0xadc kernel/softirq.c:571
  invoke_softirq kernel/softirq.c:445 [inline]
  __irq_exit_rcu+0x123/0x180 kernel/softirq.c:650
  irq_exit_rcu+0x9/0x20 kernel/softirq.c:662
  common_interrupt+0xad/0xd0 arch/x86/kernel/irq.c:240
  asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:640
  native_safe_halt arch/x86/include/asm/irqflags.h:51 [inline]
  arch_safe_halt arch/x86/include/asm/irqflags.h:89 [inline]
  acpi_safe_halt drivers/acpi/processor_idle.c:112 [inline]
  acpi_idle_do_entry+0x1fd/0x2a0 drivers/acpi/processor_idle.c:572
  acpi_idle_enter+0x368/0x510 drivers/acpi/processor_idle.c:709
  cpuidle_enter_state+0x1af/0xd40 drivers/cpuidle/cpuidle.c:239
  cpuidle_enter+0x4e/0xa0 drivers/cpuidle/cpuidle.c:356
  call_cpuidle kernel/sched/idle.c:155 [inline]
  cpuidle_idle_call kernel/sched/idle.c:236 [inline]
  do_idle+0x3f7/0x590 kernel/sched/idle.c:303
  cpu_startup_entry+0x18/0x20 kernel/sched/idle.c:400
  start_secondary+0x256/0x300 arch/x86/kernel/smpboot.c:262
  secondary_startup_64_no_verify+0xce/0xdb

to a SOFTIRQ-irq-unsafe lock:
 (k-clock-AF_INET){+++.}-{2:2}

... which became SOFTIRQ-irq-unsafe at:
...
  lock_acquire kernel/locking/lockdep.c:5668 [inline]
  lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
  __raw_write_lock include/linux/rwlock_api_smp.h:209 [inline]
  _raw_write_lock+0x2e/0x40 kernel/locking/spinlock.c:300
  l2tp_tunnel_register+0x126/0x1210 net/l2tp/l2tp_core.c:1477
  l2tp_nl_cmd_tunnel_create+0x3d6/0x8b0 net/l2tp/l2tp_netlink.c:245
  genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:756
  genl_family_rcv_msg net/netlink/genetlink.c:833 [inline]
  genl_rcv_msg+0x445/0x780 net/netlink/genetlink.c:850
  netlink_rcv_skb+0x157/0x430 net/netlink/af_netlink.c:2540
  genl_rcv+0x28/0x40 net/netlink/genetlink.c:861
  netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
  netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1345
  netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1921
  sock_sendmsg_nosec net/socket.c:714 [inline]
  sock_sendmsg+0xd3/0x120 net/socket.c:734
  ____sys_sendmsg+0x712/0x8c0 net/socket.c:2482
  ___sys_sendmsg+0x110/0x1b0 net/socket.c:2536
  __sys_sendmsg+0xf7/0x1c0 net/socket.c:2565
  do_syscall_x64 arch/x86/entry/common.c:50 [inline]
  do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
  entry_SYSCALL_64_after_hwframe+0x63/0xcd

other info that might help us debug this:

 Possible interrupt unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(k-clock-AF_INET);
                               local_irq_disable();
                               lock(&tcp_hashinfo.bhash[i].lock);
                               lock(k-clock-AF_INET);
  <Interrupt>
    lock(&tcp_hashinfo.bhash[i].lock);

 *** DEADLOCK ***

3 locks held by syz-executor117/3634:
 #0: ffff8880230d0130 (sk_lock-AF_SMC){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1721 [inline]
 #0: ffff8880230d0130 (sk_lock-AF_SMC){+.+.}-{0:0}, at: smc_bind+0x112/0x390 net/smc/af_smc.c:424
 #1: ffff888077748d30 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1721 [inline]
 #1: ffff888077748d30 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: __inet_bind+0x8c3/0xc90 net/ipv4/af_inet.c:511
 #2: ffffc9000160c6f0 (&tcp_hashinfo.bhash[i].lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:355 [inline]
 #2: ffffc9000160c6f0 (&tcp_hashinfo.bhash[i].lock){+.-.}-{2:2}, at: inet_csk_get_port+0x66a/0x2640 net/ipv4/inet_connection_sock.c:496

the dependencies between SOFTIRQ-irq-safe lock and the holding lock:
-> (&tcp_hashinfo.bhash[i].lock){+.-.}-{2:2} {
   HARDIRQ-ON-W at:
                    lock_acquire kernel/locking/lockdep.c:5668 [inline]
                    lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
                    __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:355 [inline]
                    inet_csk_get_port+0x66a/0x2640 net/ipv4/inet_connection_sock.c:496
                    __inet6_bind+0x625/0x1b20 net/ipv6/af_inet6.c:412
                    inet6_bind+0x177/0x220 net/ipv6/af_inet6.c:471
                    rds_tcp_listen_init+0x2a9/0x4e0 net/rds/tcp_listen.c:307
                    rds_tcp_init_net+0x21d/0x4f0 net/rds/tcp.c:573
                    ops_init+0xb9/0x680 net/core/net_namespace.c:135
                    __register_pernet_operations net/core/net_namespace.c:1153 [inline]
                    register_pernet_operations+0x35a/0x850 net/core/net_namespace.c:1222
                    register_pernet_device+0x2a/0x80 net/core/net_namespace.c:1309
                    rds_tcp_init+0x65/0xd3 net/rds/tcp.c:731
                    do_one_initcall+0x141/0x780 init/main.c:1303
                    do_initcall_level init/main.c:1376 [inline]
                    do_initcalls init/main.c:1392 [inline]
                    do_basic_setup init/main.c:1411 [inline]
                    kernel_init_freeable+0x6ff/0x788 init/main.c:1631
                    kernel_init+0x1e/0x1d0 init/main.c:1519
                    ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
   IN-SOFTIRQ-W at:
                    lock_acquire kernel/locking/lockdep.c:5668 [inline]
                    lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
                    __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
                    _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
                    spin_lock include/linux/spinlock.h:350 [inline]
                    __inet_inherit_port+0x297/0x14e0 net/ipv4/inet_hashtables.c:229
                    tcp_v4_syn_recv_sock+0xb5b/0x14c0 net/ipv4/tcp_ipv4.c:1588
                    tcp_check_req+0x632/0x1aa0 net/ipv4/tcp_minisocks.c:786
                    tcp_v4_rcv+0x24b4/0x3980 net/ipv4/tcp_ipv4.c:2030
                    ip_protocol_deliver_rcu+0x9f/0x7c0 net/ipv4/ip_input.c:205
                    ip_local_deliver_finish+0x2ec/0x4c0 net/ipv4/ip_input.c:233
                    NF_HOOK include/linux/netfilter.h:302 [inline]
                    NF_HOOK include/linux/netfilter.h:296 [inline]
                    ip_local_deliver+0x1ae/0x200 net/ipv4/ip_input.c:254
                    dst_input include/net/dst.h:455 [inline]
                    ip_sublist_rcv_finish+0x9a/0x2c0 net/ipv4/ip_input.c:575
                    ip_list_rcv_finish net/ipv4/ip_input.c:625 [inline]
                    ip_sublist_rcv+0x533/0x980 net/ipv4/ip_input.c:633
                    ip_list_rcv+0x31e/0x470 net/ipv4/ip_input.c:668
                    __netif_receive_skb_list_ptype net/core/dev.c:5532 [inline]
                    __netif_receive_skb_list_core+0x548/0x8f0 net/core/dev.c:5580
                    __netif_receive_skb_list net/core/dev.c:5632 [inline]
                    netif_receive_skb_list_internal+0x75f/0xd90 net/core/dev.c:5723
                    gro_normal_list include/net/gro.h:433 [inline]
                    gro_normal_list include/net/gro.h:429 [inline]
                    napi_complete_done+0x1f5/0x890 net/core/dev.c:6064
                    virtqueue_napi_complete drivers/net/virtio_net.c:401 [inline]
                    virtnet_poll+0xd08/0x1300 drivers/net/virtio_net.c:1678
                    __napi_poll+0xb8/0x770 net/core/dev.c:6498
                    napi_poll net/core/dev.c:6565 [inline]
                    net_rx_action+0xa00/0xde0 net/core/dev.c:6676
                    __do_softirq+0x1fb/0xadc kernel/softirq.c:571
                    invoke_softirq kernel/softirq.c:445 [inline]
                    __irq_exit_rcu+0x123/0x180 kernel/softirq.c:650
                    irq_exit_rcu+0x9/0x20 kernel/softirq.c:662
                    common_interrupt+0xad/0xd0 arch/x86/kernel/irq.c:240
                    asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:640
                    native_safe_halt arch/x86/include/asm/irqflags.h:51 [inline]
                    arch_safe_halt arch/x86/include/asm/irqflags.h:89 [inline]
                    acpi_safe_halt drivers/acpi/processor_idle.c:112 [inline]
                    acpi_idle_do_entry+0x1fd/0x2a0 drivers/acpi/processor_idle.c:572
                    acpi_idle_enter+0x368/0x510 drivers/acpi/processor_idle.c:709
                    cpuidle_enter_state+0x1af/0xd40 drivers/cpuidle/cpuidle.c:239
                    cpuidle_enter+0x4e/0xa0 drivers/cpuidle/cpuidle.c:356
                    call_cpuidle kernel/sched/idle.c:155 [inline]
                    cpuidle_idle_call kernel/sched/idle.c:236 [inline]
                    do_idle+0x3f7/0x590 kernel/sched/idle.c:303
                    cpu_startup_entry+0x18/0x20 kernel/sched/idle.c:400
                    start_secondary+0x256/0x300 arch/x86/kernel/smpboot.c:262
                    secondary_startup_64_no_verify+0xce/0xdb
   INITIAL USE at:
                   lock_acquire kernel/locking/lockdep.c:5668 [inline]
                   lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
                   __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:355 [inline]
                   inet_csk_get_port+0x66a/0x2640 net/ipv4/inet_connection_sock.c:496
                   __inet6_bind+0x625/0x1b20 net/ipv6/af_inet6.c:412
                   inet6_bind+0x177/0x220 net/ipv6/af_inet6.c:471
                   rds_tcp_listen_init+0x2a9/0x4e0 net/rds/tcp_listen.c:307
                   rds_tcp_init_net+0x21d/0x4f0 net/rds/tcp.c:573
                   ops_init+0xb9/0x680 net/core/net_namespace.c:135
                   __register_pernet_operations net/core/net_namespace.c:1153 [inline]
                   register_pernet_operations+0x35a/0x850 net/core/net_namespace.c:1222
                   register_pernet_device+0x2a/0x80 net/core/net_namespace.c:1309
                   rds_tcp_init+0x65/0xd3 net/rds/tcp.c:731
                   do_one_initcall+0x141/0x780 init/main.c:1303
                   do_initcall_level init/main.c:1376 [inline]
                   do_initcalls init/main.c:1392 [inline]
                   do_basic_setup init/main.c:1411 [inline]
                   kernel_init_freeable+0x6ff/0x788 init/main.c:1631
                   kernel_init+0x1e/0x1d0 init/main.c:1519
                   ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
 }
 ... key      at: [<ffffffff91d7c600>] __key.1+0x0/0x40

the dependencies between the lock to be acquired
 and SOFTIRQ-irq-unsafe lock:
-> (k-clock-AF_INET){+++.}-{2:2} {
   HARDIRQ-ON-W at:
                    lock_acquire kernel/locking/lockdep.c:5668 [inline]
                    lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
                    __raw_write_lock include/linux/rwlock_api_smp.h:209 [inline]
                    _raw_write_lock+0x2e/0x40 kernel/locking/spinlock.c:300
                    l2tp_tunnel_register+0x126/0x1210 net/l2tp/l2tp_core.c:1477
                    l2tp_nl_cmd_tunnel_create+0x3d6/0x8b0 net/l2tp/l2tp_netlink.c:245
                    genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:756
                    genl_family_rcv_msg net/netlink/genetlink.c:833 [inline]
                    genl_rcv_msg+0x445/0x780 net/netlink/genetlink.c:850
                    netlink_rcv_skb+0x157/0x430 net/netlink/af_netlink.c:2540
                    genl_rcv+0x28/0x40 net/netlink/genetlink.c:861
                    netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
                    netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1345
                    netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1921
                    sock_sendmsg_nosec net/socket.c:714 [inline]
                    sock_sendmsg+0xd3/0x120 net/socket.c:734
                    ____sys_sendmsg+0x712/0x8c0 net/socket.c:2482
                    ___sys_sendmsg+0x110/0x1b0 net/socket.c:2536
                    __sys_sendmsg+0xf7/0x1c0 net/socket.c:2565
                    do_syscall_x64 arch/x86/entry/common.c:50 [inline]
                    do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
                    entry_SYSCALL_64_after_hwframe+0x63/0xcd
   HARDIRQ-ON-R at:
                    lock_acquire kernel/locking/lockdep.c:5668 [inline]
                    lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
                    __raw_read_lock_bh include/linux/rwlock_api_smp.h:176 [inline]
                    _raw_read_lock_bh+0x3f/0x70 kernel/locking/spinlock.c:252
                    sock_i_uid+0x1f/0xb0 net/core/sock.c:2542
                    udp_lib_lport_inuse+0x32/0x490 net/ipv4/udp.c:140
                    udp_lib_get_port+0x835/0x18c0 net/ipv4/udp.c:306
                    __inet_bind+0x831/0xc90 net/ipv4/af_inet.c:525
                    inet_bind+0x177/0x220 net/ipv4/af_inet.c:456
                    udp_sock_create4+0x1d1/0x490 net/ipv4/udp_tunnel_core.c:30
                    udp_sock_create include/net/udp_tunnel.h:59 [inline]
                    rxe_setup_udp_tunnel.constprop.0+0xfc/0x220 drivers/infiniband/sw/rxe/rxe_net.c:186
                    rxe_net_ipv4_init drivers/infiniband/sw/rxe/rxe_net.c:622 [inline]
                    rxe_net_init+0x1f/0xd0 drivers/infiniband/sw/rxe/rxe_net.c:667
                    rxe_module_init+0x10/0x49 drivers/infiniband/sw/rxe/rxe.c:213
                    do_one_initcall+0x141/0x780 init/main.c:1303
                    do_initcall_level init/main.c:1376 [inline]
                    do_initcalls init/main.c:1392 [inline]
                    do_basic_setup init/main.c:1411 [inline]
                    kernel_init_freeable+0x6ff/0x788 init/main.c:1631
                    kernel_init+0x1e/0x1d0 init/main.c:1519
                    ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
   SOFTIRQ-ON-W at:
                    lock_acquire kernel/locking/lockdep.c:5668 [inline]
                    lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
                    __raw_write_lock include/linux/rwlock_api_smp.h:209 [inline]
                    _raw_write_lock+0x2e/0x40 kernel/locking/spinlock.c:300
                    l2tp_tunnel_register+0x126/0x1210 net/l2tp/l2tp_core.c:1477
                    l2tp_nl_cmd_tunnel_create+0x3d6/0x8b0 net/l2tp/l2tp_netlink.c:245
                    genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:756
                    genl_family_rcv_msg net/netlink/genetlink.c:833 [inline]
                    genl_rcv_msg+0x445/0x780 net/netlink/genetlink.c:850
                    netlink_rcv_skb+0x157/0x430 net/netlink/af_netlink.c:2540
                    genl_rcv+0x28/0x40 net/netlink/genetlink.c:861
                    netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
                    netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1345
                    netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1921
                    sock_sendmsg_nosec net/socket.c:714 [inline]
                    sock_sendmsg+0xd3/0x120 net/socket.c:734
                    ____sys_sendmsg+0x712/0x8c0 net/socket.c:2482
                    ___sys_sendmsg+0x110/0x1b0 net/socket.c:2536
                    __sys_sendmsg+0xf7/0x1c0 net/socket.c:2565
                    do_syscall_x64 arch/x86/entry/common.c:50 [inline]
                    do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
                    entry_SYSCALL_64_after_hwframe+0x63/0xcd
   INITIAL USE at:
                   lock_acquire kernel/locking/lockdep.c:5668 [inline]
                   lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
                   __raw_write_lock include/linux/rwlock_api_smp.h:209 [inline]
                   _raw_write_lock+0x2e/0x40 kernel/locking/spinlock.c:300
                   l2tp_tunnel_register+0x126/0x1210 net/l2tp/l2tp_core.c:1477
                   l2tp_nl_cmd_tunnel_create+0x3d6/0x8b0 net/l2tp/l2tp_netlink.c:245
                   genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:756
                   genl_family_rcv_msg net/netlink/genetlink.c:833 [inline]
                   genl_rcv_msg+0x445/0x780 net/netlink/genetlink.c:850
                   netlink_rcv_skb+0x157/0x430 net/netlink/af_netlink.c:2540
                   genl_rcv+0x28/0x40 net/netlink/genetlink.c:861
                   netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
                   netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1345
                   netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1921
                   sock_sendmsg_nosec net/socket.c:714 [inline]
                   sock_sendmsg+0xd3/0x120 net/socket.c:734
                   ____sys_sendmsg+0x712/0x8c0 net/socket.c:2482
                   ___sys_sendmsg+0x110/0x1b0 net/socket.c:2536
                   __sys_sendmsg+0xf7/0x1c0 net/socket.c:2565
                   do_syscall_x64 arch/x86/entry/common.c:50 [inline]
                   do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
                   entry_SYSCALL_64_after_hwframe+0x63/0xcd
   INITIAL READ USE at:
                        lock_acquire kernel/locking/lockdep.c:5668 [inline]
                        lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
                        __raw_read_lock_bh include/linux/rwlock_api_smp.h:176 [inline]
                        _raw_read_lock_bh+0x3f/0x70 kernel/locking/spinlock.c:252
                        sock_i_uid+0x1f/0xb0 net/core/sock.c:2542
                        udp_lib_lport_inuse+0x32/0x490 net/ipv4/udp.c:140
                        udp_lib_get_port+0x835/0x18c0 net/ipv4/udp.c:306
                        __inet_bind+0x831/0xc90 net/ipv4/af_inet.c:525
                        inet_bind+0x177/0x220 net/ipv4/af_inet.c:456
                        udp_sock_create4+0x1d1/0x490 net/ipv4/udp_tunnel_core.c:30
                        udp_sock_create include/net/udp_tunnel.h:59 [inline]
                        rxe_setup_udp_tunnel.constprop.0+0xfc/0x220 drivers/infiniband/sw/rxe/rxe_net.c:186
                        rxe_net_ipv4_init drivers/infiniband/sw/rxe/rxe_net.c:622 [inline]
                        rxe_net_init+0x1f/0xd0 drivers/infiniband/sw/rxe/rxe_net.c:667
                        rxe_module_init+0x10/0x49 drivers/infiniband/sw/rxe/rxe.c:213
                        do_one_initcall+0x141/0x780 init/main.c:1303
                        do_initcall_level init/main.c:1376 [inline]
                        do_initcalls init/main.c:1392 [inline]
                        do_basic_setup init/main.c:1411 [inline]
                        kernel_init_freeable+0x6ff/0x788 init/main.c:1631
                        kernel_init+0x1e/0x1d0 init/main.c:1519
                        ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
 }
 ... key      at: [<ffffffff91d5be20>] af_kern_callback_keys+0x20/0x300
 ... acquired at:
   lock_acquire kernel/locking/lockdep.c:5668 [inline]
   lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
   __raw_read_lock_bh include/linux/rwlock_api_smp.h:176 [inline]
   _raw_read_lock_bh+0x3f/0x70 kernel/locking/spinlock.c:252
   sock_i_uid+0x1f/0xb0 net/core/sock.c:2542
   inet_bhash2_addr_any_conflict+0x2d/0x460 net/ipv4/inet_connection_sock.c:248
   inet_csk_get_port+0x1cb2/0x2640 net/ipv4/inet_connection_sock.c:519
   __inet_bind+0x831/0xc90 net/ipv4/af_inet.c:525
   inet_bind+0x177/0x220 net/ipv4/af_inet.c:456
   smc_bind+0x2e6/0x390 net/smc/af_smc.c:433
   __sys_bind+0x1ed/0x260 net/socket.c:1776
   __do_sys_bind net/socket.c:1787 [inline]
   __se_sys_bind net/socket.c:1785 [inline]
   __x64_sys_bind+0x73/0xb0 net/socket.c:1785
   do_syscall_x64 arch/x86/entry/common.c:50 [inline]
   do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
   entry_SYSCALL_64_after_hwframe+0x63/0xcd


stack backtrace:
CPU: 1 PID: 3634 Comm: syz-executor117 Not tainted 6.1.0-rc5-syzkaller-00144-g84368d882b96 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
 print_bad_irq_dependency kernel/locking/lockdep.c:2611 [inline]
 check_irq_usage.cold+0x4e4/0x761 kernel/locking/lockdep.c:2850
 check_prev_add kernel/locking/lockdep.c:3101 [inline]
 check_prevs_add kernel/locking/lockdep.c:3216 [inline]
 validate_chain kernel/locking/lockdep.c:3831 [inline]
 __lock_acquire+0x2a5b/0x56d0 kernel/locking/lockdep.c:5055
 lock_acquire kernel/locking/lockdep.c:5668 [inline]
 lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
 __raw_read_lock_bh include/linux/rwlock_api_smp.h:176 [inline]
 _raw_read_lock_bh+0x3f/0x70 kernel/locking/spinlock.c:252
 sock_i_uid+0x1f/0xb0 net/core/sock.c:2542
 inet_bhash2_addr_any_conflict+0x2d/0x460 net/ipv4/inet_connection_sock.c:248
 inet_csk_get_port+0x1cb2/0x2640 net/ipv4/inet_connection_sock.c:519
 __inet_bind+0x831/0xc90 net/ipv4/af_inet.c:525
 inet_bind+0x177/0x220 net/ipv4/af_inet.c:456
 smc_bind+0x2e6/0x390 net/smc/af_smc.c:433
 __sys_bind+0x1ed/0x260 net/socket.c:1776
 __do_sys_bind net/socket.c:1787 [inline]
 __se_sys_bind net/socket.c:1785 [inline]
 __x64_sys_bind+0x73/0xb0 net/socket.c:1785
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fb5966d0c09
Code: 28 c3 e8 5a 14 00 00 66 2e 0f 1f 84 00 00 00 00 00 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff23b3ad08 EFLAGS: 00000246 ORIG_RAX: 0000000000000031
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fb5966d0c09
RDX: 0000000000000010 RSI: 0000000020000040 RDI: 0000000000000004
RBP: 00007fb5966945d0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fb596694660
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Crashes (85):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/11/18 21:41 upstream 84368d882b96 5bb70014 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in __inet_inherit_port
2022/11/18 02:54 upstream 81ac25651a62 4ba8ab94 .config strace log report syz C ci-upstream-kasan-gce-selinux-root possible deadlock in __inet_inherit_port
2022/11/18 20:46 net-old 11b64a466c95 5bb70014 .config strace log report syz C ci-upstream-net-this-kasan-gce possible deadlock in __inet_inherit_port
2022/11/24 05:31 upstream 4312098baf37 12c66417 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in __inet_inherit_port
2022/11/23 20:00 upstream eb7081409f94 12c66417 .config console log report info ci-upstream-kasan-gce-selinux-root possible deadlock in __inet_inherit_port
2022/11/23 09:40 upstream eb7081409f94 75740b3f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in __inet_inherit_port
2022/11/22 22:38 upstream eb7081409f94 9da37ae8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in __inet_inherit_port
2022/11/22 20:08 upstream eb7081409f94 9da37ae8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in __inet_inherit_port
2022/11/21 20:26 upstream eb7081409f94 1c576c23 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in __inet_inherit_port
2022/11/21 19:32 upstream eb7081409f94 1c576c23 .config console log report info ci-upstream-kasan-gce possible deadlock in __inet_inherit_port
2022/11/21 03:01 upstream 894909f95aa1 5bb70014 .config console log report info ci-upstream-kasan-gce possible deadlock in __inet_inherit_port
2022/11/20 16:58 upstream b6e7fdfd6f6a 5bb70014 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in __inet_inherit_port
2022/11/20 06:11 upstream b6e7fdfd6f6a 5bb70014 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in __inet_inherit_port
2022/11/19 21:19 upstream fe24a97cf254 5bb70014 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in __inet_inherit_port
2022/11/18 02:04 upstream 81ac25651a62 4ba8ab94 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in __inet_inherit_port
2022/11/25 03:13 upstream c3eb11fbb826 62e26685 .config console log report info ci-upstream-kasan-gce-386 possible deadlock in __inet_inherit_port
2022/11/24 17:03 upstream c3eb11fbb826 d6358a0d .config console log report info ci-qemu-upstream-386 possible deadlock in __inet_inherit_port
2022/11/24 15:46 upstream c3eb11fbb826 d6358a0d .config console log report info ci-qemu-upstream-386 possible deadlock in __inet_inherit_port
2022/11/24 00:41 upstream 4312098baf37 ff68ff8f .config console log report info ci-qemu-upstream-386 possible deadlock in __inet_inherit_port
2022/11/23 12:52 upstream eb7081409f94 3c2d90bc .config console log report info ci-qemu-upstream-386 possible deadlock in __inet_inherit_port
2022/11/23 07:10 upstream eb7081409f94 75740b3f .config console log report info ci-qemu-upstream-386 possible deadlock in __inet_inherit_port
2022/11/22 21:34 upstream eb7081409f94 9da37ae8 .config console log report info ci-upstream-kasan-gce-386 possible deadlock in __inet_inherit_port
2022/11/22 03:53 upstream eb7081409f94 1c576c23 .config console log report info ci-qemu-upstream-386 possible deadlock in __inet_inherit_port
2022/11/21 21:56 upstream eb7081409f94 1c576c23 .config console log report info ci-upstream-kasan-gce-386 possible deadlock in __inet_inherit_port
2022/11/21 15:19 upstream eb7081409f94 f9a97739 .config console log report info ci-qemu-upstream-386 possible deadlock in __inet_inherit_port
2022/11/21 04:01 upstream 77c51ba552a1 5bb70014 .config console log report info ci-upstream-kasan-gce-386 possible deadlock in __inet_inherit_port
2022/11/20 19:32 upstream 77c51ba552a1 5bb70014 .config console log report info ci-qemu-upstream-386 possible deadlock in __inet_inherit_port
2022/11/20 12:28 upstream b6e7fdfd6f6a 5bb70014 .config console log report info ci-upstream-kasan-gce-386 possible deadlock in __inet_inherit_port
2022/11/20 09:33 upstream b6e7fdfd6f6a 5bb70014 .config console log report info ci-upstream-kasan-gce-386 possible deadlock in __inet_inherit_port
2022/11/20 02:05 upstream b6e7fdfd6f6a 5bb70014 .config console log report info ci-qemu-upstream-386 possible deadlock in __inet_inherit_port
2022/11/17 18:32 upstream 81ac25651a62 4ba8ab94 .config console log report info ci-qemu-upstream-386 possible deadlock in __inet_inherit_port
2022/11/23 17:40 net-old 178a4ff11903 75740b3f .config console log report info ci-upstream-net-this-kasan-gce possible deadlock in __inet_inherit_port
2022/11/23 02:05 net-old 2dc4ac91f845 9da37ae8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in __inet_inherit_port
2022/11/22 01:58 net-old 9ab000d9ac54 1c576c23 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in __inet_inherit_port
2022/11/20 18:57 net-old 2360f9b8c4e8 5bb70014 .config console log report info ci-upstream-net-this-kasan-gce possible deadlock in __inet_inherit_port
2022/11/20 00:25 net-old 2360f9b8c4e8 5bb70014 .config console log report info ci-upstream-net-this-kasan-gce possible deadlock in __inet_inherit_port
2022/11/19 21:03 net-old 2360f9b8c4e8 5bb70014 .config console log report info ci-upstream-net-this-kasan-gce possible deadlock in __inet_inherit_port
2022/11/30 05:14 net-next-old 7a168f560e3c 05dc7993 .config console log report info ci-upstream-net-kasan-gce possible deadlock in __inet_inherit_port
2022/11/29 16:23 net-next-old 7a168f560e3c 05dc7993 .config console log report info ci-upstream-net-kasan-gce possible deadlock in __inet_inherit_port
2022/11/29 13:45 net-next-old 7a168f560e3c 05dc7993 .config console log report info ci-upstream-net-kasan-gce possible deadlock in __inet_inherit_port
2022/11/28 14:59 net-next-old a66d79ee0bd5 247de55b .config console log report info ci-upstream-net-kasan-gce possible deadlock in __inet_inherit_port
2022/11/28 12:19 net-next-old a66d79ee0bd5 247de55b .config console log report info ci-upstream-net-kasan-gce possible deadlock in __inet_inherit_port
2022/11/28 08:19 net-next-old a6e3d86ece0b 74a66371 .config console log report info ci-upstream-net-kasan-gce possible deadlock in __inet_inherit_port
2022/11/28 03:14 net-next-old a6e3d86ece0b 74a66371 .config console log report info ci-upstream-net-kasan-gce possible deadlock in __inet_inherit_port
2022/11/27 17:21 net-next-old a6e3d86ece0b 74a66371 .config console log report info ci-upstream-net-kasan-gce possible deadlock in __inet_inherit_port
2022/11/27 04:19 net-next-old a6e3d86ece0b 74a66371 .config console log report info ci-upstream-net-kasan-gce possible deadlock in __inet_inherit_port
2022/11/26 10:44 net-next-old a6e3d86ece0b 74a66371 .config console log report info ci-upstream-net-kasan-gce possible deadlock in __inet_inherit_port
2022/11/24 18:17 net-next-old 170d97739de4 62e26685 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in __inet_inherit_port
2022/11/22 18:26 net-next-old 339e79dfb087 9da37ae8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in __inet_inherit_port
2022/11/22 15:13 net-next-old 696450c05181 1c576c23 .config console log report info ci-upstream-net-kasan-gce possible deadlock in __inet_inherit_port
2022/11/21 14:22 net-next-old 8719a1c30d3a 5bb70014 .config console log report info ci-upstream-net-kasan-gce possible deadlock in __inet_inherit_port
2022/11/21 10:01 net-next-old 8bd8dcc5e47f 5bb70014 .config console log report info ci-upstream-net-kasan-gce possible deadlock in __inet_inherit_port
2022/11/19 21:55 net-next-old ab0377803daf 5bb70014 .config console log report info ci-upstream-net-kasan-gce possible deadlock in __inet_inherit_port
2023/01/18 01:59 linux-next 9ce08dd7ea24 aedf5331 .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in __inet_inherit_port
2022/11/26 02:54 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6d464646530f 74a66371 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in __inet_inherit_port
2022/11/25 06:13 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 65762d97e6fa 74a66371 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in __inet_inherit_port
2022/11/22 10:41 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a77d28d13789 1c576c23 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in __inet_inherit_port
* Struck through repros no longer work on HEAD.