syzbot


possible deadlock in sctp_addr_wq_timeout_handler

Status: auto-closed as invalid on 2021/08/26 12:08
Reported-by: syzbot+c735e1c426c273b10493@syzkaller.appspotmail.com
First crash: 1262d, last: 1262d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in sctp_addr_wq_timeout_handler sctp C done 8 1260d 1260d 20/28 fixed on 2021/11/10 00:50

Sample crash report:
IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
wlan1: Created IBSS using preconfigured BSSID 50:50:50:50:50:50
wlan1: Creating new IBSS network, BSSID 50:50:50:50:50:50
IPv6: ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready
======================================================
WARNING: possible circular locking dependency detected
4.19.189-syzkaller #0 Not tainted
------------------------------------------------------
swapper/0/0 is trying to acquire lock:
0000000003e0fbc5 (slock-AF_INET6){+.-.}, at: spin_lock include/linux/spinlock.h:329 [inline]
0000000003e0fbc5 (slock-AF_INET6){+.-.}, at: sctp_addr_wq_timeout_handler+0x1a1/0x550 net/sctp/protocol.c:680

but task is already holding lock:
000000001e83ae24 (&(&net->sctp.addr_wq_lock)->rlock){+.-.}, at: spin_lock_bh include/linux/spinlock.h:334 [inline]
000000001e83ae24 (&(&net->sctp.addr_wq_lock)->rlock){+.-.}, at: sctp_addr_wq_timeout_handler+0x38/0x550 net/sctp/protocol.c:640

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&(&net->sctp.addr_wq_lock)->rlock){+.-.}:
       spin_lock_bh include/linux/spinlock.h:334 [inline]
       sctp_destroy_sock+0x234/0x480 net/sctp/socket.c:4811
       sctp_v6_destroy_sock+0x11/0x20 net/sctp/socket.c:8973
       sk_common_release+0x64/0x2d0 net/core/sock.c:3093
       sctp_close+0x46d/0x800 net/sctp/socket.c:1580
       inet_release+0xd7/0x1e0 net/ipv4/af_inet.c:427
       inet6_release+0x4c/0x70 net/ipv6/af_inet6.c:472
       __sock_release+0xcd/0x2a0 net/socket.c:579
       sock_close+0x15/0x20 net/socket.c:1140
       __fput+0x2ce/0x890 fs/file_table.c:278
       task_work_run+0x148/0x1c0 kernel/task_work.c:113
       tracehook_notify_resume include/linux/tracehook.h:193 [inline]
       exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
       prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
       syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
       do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (slock-AF_INET6){+.-.}:
       __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
       _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:144
       spin_lock include/linux/spinlock.h:329 [inline]
       sctp_addr_wq_timeout_handler+0x1a1/0x550 net/sctp/protocol.c:680
       call_timer_fn+0x177/0x700 kernel/time/timer.c:1338
       expire_timers+0x243/0x4e0 kernel/time/timer.c:1375
       __run_timers kernel/time/timer.c:1696 [inline]
       run_timer_softirq+0x21c/0x670 kernel/time/timer.c:1709
       __do_softirq+0x265/0x980 kernel/softirq.c:292
       invoke_softirq kernel/softirq.c:372 [inline]
       irq_exit+0x215/0x260 kernel/softirq.c:412
       exiting_irq arch/x86/include/asm/apic.h:535 [inline]
       smp_apic_timer_interrupt+0x136/0x550 arch/x86/kernel/apic/apic.c:1098
       apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:894
       native_safe_halt+0xe/0x10 arch/x86/include/asm/irqflags.h:60
       arch_safe_halt arch/x86/include/asm/paravirt.h:94 [inline]
       default_idle+0x49/0x310 arch/x86/kernel/process.c:557
       cpuidle_idle_call kernel/sched/idle.c:153 [inline]
       do_idle+0x2ec/0x4b0 kernel/sched/idle.c:263
       cpu_startup_entry+0xc5/0xe0 kernel/sched/idle.c:369
       start_kernel+0x8d6/0x911 init/main.c:736
       secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&(&net->sctp.addr_wq_lock)->rlock);
                               lock(slock-AF_INET6);
                               lock(&(&net->sctp.addr_wq_lock)->rlock);
  lock(slock-AF_INET6);

 *** DEADLOCK ***

2 locks held by swapper/0/0:
 #0: 000000009aa23dc6 ((&net->sctp.addr_wq_timer)){+.-.}, at: lockdep_copy_map include/linux/lockdep.h:168 [inline]
 #0: 000000009aa23dc6 ((&net->sctp.addr_wq_timer)){+.-.}, at: call_timer_fn+0xc9/0x700 kernel/time/timer.c:1328
 #1: 000000001e83ae24 (&(&net->sctp.addr_wq_lock)->rlock){+.-.}, at: spin_lock_bh include/linux/spinlock.h:334 [inline]
 #1: 000000001e83ae24 (&(&net->sctp.addr_wq_lock)->rlock){+.-.}, at: sctp_addr_wq_timeout_handler+0x38/0x550 net/sctp/protocol.c:640

stack backtrace:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.19.189-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1222
 check_prev_add kernel/locking/lockdep.c:1866 [inline]
 check_prevs_add kernel/locking/lockdep.c:1979 [inline]
 validate_chain kernel/locking/lockdep.c:2420 [inline]
 __lock_acquire+0x30c9/0x3ff0 kernel/locking/lockdep.c:3416
 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3908
 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
 _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:144
 spin_lock include/linux/spinlock.h:329 [inline]
 sctp_addr_wq_timeout_handler+0x1a1/0x550 net/sctp/protocol.c:680
 call_timer_fn+0x177/0x700 kernel/time/timer.c:1338
 expire_timers+0x243/0x4e0 kernel/time/timer.c:1375
 __run_timers kernel/time/timer.c:1696 [inline]
 run_timer_softirq+0x21c/0x670 kernel/time/timer.c:1709
 __do_softirq+0x265/0x980 kernel/softirq.c:292
 invoke_softirq kernel/softirq.c:372 [inline]
 irq_exit+0x215/0x260 kernel/softirq.c:412
 exiting_irq arch/x86/include/asm/apic.h:535 [inline]
 smp_apic_timer_interrupt+0x136/0x550 arch/x86/kernel/apic/apic.c:1098
 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:894
 </IRQ>
RIP: 0010:native_safe_halt+0xe/0x10 arch/x86/include/asm/irqflags.h:61
Code: 48 89 df e8 a4 36 80 f9 e9 2e ff ff ff 48 89 df e8 97 36 80 f9 eb 82 90 90 90 90 90 e9 07 00 00 00 0f 00 2d b4 9a 4f 00 fb f4 <c3> 90 e9 07 00 00 00 0f 00 2d a4 9a 4f 00 f4 c3 90 90 41 56 41 55
RSP: 0018:ffffffff89e07d40 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff13
RAX: 1ffffffff13e304c RBX: dffffc0000000000 RCX: 0000000000000000
RDX: dffffc0000000000 RSI: 0000000000000001 RDI: ffffffff89e78904
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff89f18250
R13: 1ffffffff13c0fb2 R14: 0000000000000000 R15: 0000000000000000
 arch_safe_halt arch/x86/include/asm/paravirt.h:94 [inline]
 default_idle+0x49/0x310 arch/x86/kernel/process.c:557
 cpuidle_idle_call kernel/sched/idle.c:153 [inline]
 do_idle+0x2ec/0x4b0 kernel/sched/idle.c:263
 cpu_startup_entry+0xc5/0xe0 kernel/sched/idle.c:369
 start_kernel+0x8d6/0x911 init/main.c:736
 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243
devpts: called with bogus options
devpts: called with bogus options
devpts: called with bogus options
devpts: called with bogus options
devpts: called with bogus options
devpts: called with bogus options
devpts: called with bogus options
devpts: called with bogus options
devpts: called with bogus options
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.4'.
devpts: called with bogus options
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.2'.
IPv6: ADDRCONF(NETDEV_UP): veth3: link is not ready
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.4'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.2'.
devpts: called with bogus options
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.5'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.4'.
IPv6: ADDRCONF(NETDEV_UP): veth3: link is not ready
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.2'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.4'.
IPv6: ADDRCONF(NETDEV_UP): veth5: link is not ready
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.5'.
IPv6: ADDRCONF(NETDEV_UP): veth5: link is not ready
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.2'.
IPv6: ADDRCONF(NETDEV_UP): veth7: link is not ready
IPv6: ADDRCONF(NETDEV_UP): veth7: link is not ready
IPv6: ADDRCONF(NETDEV_UP): veth9: link is not ready
IPv6: ADDRCONF(NETDEV_UP): veth11: link is not ready

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/04/28 12:07 linux-4.19.y 97a8651cadce 77e2b668 .config console log report info ci2-linux-4-19 possible deadlock in sctp_addr_wq_timeout_handler
* Struck through repros no longer work on HEAD.