syzbot


possible deadlock in prb_calc_retire_blk_tmo

Status: auto-obsoleted due to no activity on 2023/05/23 05:23
Subsystems: net
[Documentation on labels]
First crash: 713d, last: 713d

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.2.0-rc8-syzkaller-00002-gb408817d4884 #0 Not tainted
------------------------------------------------------
syz-executor.0/21347 is trying to acquire lock:
ffffffff8e0d5fa8 (rtnl_mutex){+.+.}-{3:3}, at: prb_calc_retire_blk_tmo+0x7d/0x1e0 net/packet/af_packet.c:576

but task is already holding lock:
ffff8880446c6130 (sk_lock-AF_PACKET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1725 [inline]
ffff8880446c6130 (sk_lock-AF_PACKET){+.+.}-{0:0}, at: packet_setsockopt+0x155/0x3a30 net/packet/af_packet.c:3791

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (sk_lock-AF_PACKET){+.+.}-{0:0}:
       lock_sock_nested+0x3a/0xf0 net/core/sock.c:3471
       lock_sock include/net/sock.h:1725 [inline]
       l2tp_tunnel_register+0x2aa/0x11e0 net/l2tp/l2tp_core.c:1483
       pppol2tp_connect+0xcdc/0x1a10 net/l2tp/l2tp_ppp.c:723
       __sys_connect_file+0x153/0x1a0 net/socket.c:1976
       __sys_connect+0x165/0x1a0 net/socket.c:1993
       __do_sys_connect net/socket.c:2003 [inline]
       __se_sys_connect net/socket.c:2000 [inline]
       __ia32_sys_connect+0x72/0xb0 net/socket.c:2000
       do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
       __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178
       do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
       entry_SYSENTER_compat_after_hwframe+0x70/0x82

-> #2 (sk_lock-AF_PPPOX){+.+.}-{0:0}:
       lock_sock_nested+0x3a/0xf0 net/core/sock.c:3471
       lock_sock include/net/sock.h:1725 [inline]
       pppoe_flush_dev drivers/net/ppp/pppoe.c:304 [inline]
       pppoe_device_event+0x329/0x980 drivers/net/ppp/pppoe.c:346
       notifier_call_chain+0xb5/0x200 kernel/notifier.c:87
       call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1944
       call_netdevice_notifiers_extack net/core/dev.c:1982 [inline]
       call_netdevice_notifiers net/core/dev.c:1996 [inline]
       dev_set_mac_address+0x2d7/0x3e0 net/core/dev.c:8791
       bond_set_mac_address+0x359/0x7a0 drivers/net/bonding/bond_main.c:4743
       dev_set_mac_address+0x26b/0x3e0 net/core/dev.c:8787
       dev_set_mac_address_user+0x31/0x50 net/core/dev.c:8805
       do_setlink+0x18c4/0x3bb0 net/core/rtnetlink.c:2775
       __rtnl_newlink+0xd69/0x1840 net/core/rtnetlink.c:3590
       rtnl_newlink+0x68/0xa0 net/core/rtnetlink.c:3637
       rtnetlink_rcv_msg+0x43e/0xca0 net/core/rtnetlink.c:6141
       netlink_rcv_skb+0x165/0x440 net/netlink/af_netlink.c:2574
       netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline]
       netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1365
       netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1942
       sock_sendmsg_nosec net/socket.c:714 [inline]
       sock_sendmsg+0xd3/0x120 net/socket.c:734
       ____sys_sendmsg+0x712/0x8c0 net/socket.c:2476
       ___sys_sendmsg+0x110/0x1b0 net/socket.c:2530
       __sys_sendmsg+0xf7/0x1c0 net/socket.c:2559
       do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
       __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178
       do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
       entry_SYSENTER_compat_after_hwframe+0x70/0x82

-> #1 (dev_addr_sem){++++}-{3:3}:
       down_write+0x94/0x220 kernel/locking/rwsem.c:1562
       dev_set_mac_address_user+0x23/0x50 net/core/dev.c:8804
       do_setlink+0x18c4/0x3bb0 net/core/rtnetlink.c:2775
       __rtnl_newlink+0xd69/0x1840 net/core/rtnetlink.c:3590
       rtnl_newlink+0x68/0xa0 net/core/rtnetlink.c:3637
       rtnetlink_rcv_msg+0x43e/0xca0 net/core/rtnetlink.c:6141
       netlink_rcv_skb+0x165/0x440 net/netlink/af_netlink.c:2574
       netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline]
       netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1365
       netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1942
       sock_sendmsg_nosec net/socket.c:714 [inline]
       sock_sendmsg+0xd3/0x120 net/socket.c:734
       __sys_sendto+0x23a/0x340 net/socket.c:2117
       __do_compat_sys_socketcall+0x62e/0x720 net/compat.c:474
       do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
       __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178
       do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
       entry_SYSENTER_compat_after_hwframe+0x70/0x82

-> #0 (rtnl_mutex){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3097 [inline]
       check_prevs_add kernel/locking/lockdep.c:3216 [inline]
       validate_chain kernel/locking/lockdep.c:3831 [inline]
       __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055
       lock_acquire kernel/locking/lockdep.c:5668 [inline]
       lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747
       prb_calc_retire_blk_tmo+0x7d/0x1e0 net/packet/af_packet.c:576
       init_prb_bdqc net/packet/af_packet.c:634 [inline]
       packet_set_ring+0x158f/0x1980 net/packet/af_packet.c:4439
       packet_setsockopt+0x1a32/0x3a30 net/packet/af_packet.c:3808
       __sys_setsockopt+0x2c6/0x5b0 net/socket.c:2246
       __do_sys_setsockopt net/socket.c:2257 [inline]
       __se_sys_setsockopt net/socket.c:2254 [inline]
       __ia32_sys_setsockopt+0xbd/0x150 net/socket.c:2254
       do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
       __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178
       do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
       entry_SYSENTER_compat_after_hwframe+0x70/0x82

other info that might help us debug this:

Chain exists of:
  rtnl_mutex --> sk_lock-AF_PPPOX --> sk_lock-AF_PACKET

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(sk_lock-AF_PACKET);
                               lock(sk_lock-AF_PPPOX);
                               lock(sk_lock-AF_PACKET);
  lock(rtnl_mutex);

 *** DEADLOCK ***

1 lock held by syz-executor.0/21347:
 #0: ffff8880446c6130 (sk_lock-AF_PACKET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1725 [inline]
 #0: ffff8880446c6130 (sk_lock-AF_PACKET){+.+.}-{0:0}, at: packet_setsockopt+0x155/0x3a30 net/packet/af_packet.c:3791

stack backtrace:
CPU: 0 PID: 21347 Comm: syz-executor.0 Not tainted 6.2.0-rc8-syzkaller-00002-gb408817d4884 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2177
 check_prev_add kernel/locking/lockdep.c:3097 [inline]
 check_prevs_add kernel/locking/lockdep.c:3216 [inline]
 validate_chain kernel/locking/lockdep.c:3831 [inline]
 __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055
 lock_acquire kernel/locking/lockdep.c:5668 [inline]
 lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
 __mutex_lock_common kernel/locking/mutex.c:603 [inline]
 __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747
 prb_calc_retire_blk_tmo+0x7d/0x1e0 net/packet/af_packet.c:576
 init_prb_bdqc net/packet/af_packet.c:634 [inline]
 packet_set_ring+0x158f/0x1980 net/packet/af_packet.c:4439
 packet_setsockopt+0x1a32/0x3a30 net/packet/af_packet.c:3808
 __sys_setsockopt+0x2c6/0x5b0 net/socket.c:2246
 __do_sys_setsockopt net/socket.c:2257 [inline]
 __se_sys_setsockopt net/socket.c:2254 [inline]
 __ia32_sys_setsockopt+0xbd/0x150 net/socket.c:2254
 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
 __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178
 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
 entry_SYSENTER_compat_after_hwframe+0x70/0x82
RIP: 0023:0xf7f99549
Code: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00
RSP: 002b:00000000f7f525cc EFLAGS: 00000296 ORIG_RAX: 000000000000016e
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000000107
RDX: 0000000000000005 RSI: 00000000200000c0 RDI: 000000000000001c
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>
----------------
Code disassembly (best guess):
   0:	03 74 c0 01          	add    0x1(%rax,%rax,8),%esi
   4:	10 05 03 74 b8 01    	adc    %al,0x1b87403(%rip)        # 0x1b8740d
   a:	10 06                	adc    %al,(%rsi)
   c:	03 74 b4 01          	add    0x1(%rsp,%rsi,4),%esi
  10:	10 07                	adc    %al,(%rdi)
  12:	03 74 b0 01          	add    0x1(%rax,%rsi,4),%esi
  16:	10 08                	adc    %cl,(%rax)
  18:	03 74 d8 01          	add    0x1(%rax,%rbx,8),%esi
  1c:	00 00                	add    %al,(%rax)
  1e:	00 00                	add    %al,(%rax)
  20:	00 51 52             	add    %dl,0x52(%rcx)
  23:	55                   	push   %rbp
  24:	89 e5                	mov    %esp,%ebp
  26:	0f 34                	sysenter
  28:	cd 80                	int    $0x80
* 2a:	5d                   	pop    %rbp <-- trapping instruction
  2b:	5a                   	pop    %rdx
  2c:	59                   	pop    %rcx
  2d:	c3                   	retq
  2e:	90                   	nop
  2f:	90                   	nop
  30:	90                   	nop
  31:	90                   	nop
  32:	8d b4 26 00 00 00 00 	lea    0x0(%rsi,%riz,1),%esi
  39:	8d b4 26 00 00 00 00 	lea    0x0(%rsi,%riz,1),%esi

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/02/14 04:14 upstream b408817d4884 93ae7e0a .config console log report info ci-upstream-kasan-gce-386 possible deadlock in prb_calc_retire_blk_tmo
* Struck through repros no longer work on HEAD.