syzbot


possible deadlock in skb_queue_tail (4)

Status: upstream: reported on 2022/09/20 12:53
Reported-by: syzbot+44b38bcb874d81a15a57@syzkaller.appspotmail.com
First crash: 71d, last: 62d
similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in skb_queue_tail (3) 4 234d 492d 0/24 auto-closed as invalid on 2022/08/04 19:39
upstream possible deadlock in skb_queue_tail (2) 1 652d 648d 0/24 auto-closed as invalid on 2021/06/12 20:45
upstream possible deadlock in skb_queue_tail 33 1347d 1699d 0/24 auto-closed as invalid on 2019/09/16 10:00

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.0.0-rc6-syzkaller-00321-g105a36f3694e #0 Not tainted
------------------------------------------------------
syz-executor.2/31232 is trying to acquire lock:
ffff88807a3ef9e8 (rlock-AF_UNIX){+.+.}-{2:2}, at: skb_queue_tail+0x21/0x140 net/core/skbuff.c:3400

but task is already holding lock:
ffff88807a3efe70 (&u->lock/1){+.+.}-{2:2}, at: unix_state_double_lock net/unix/af_unix.c:1298 [inline]
ffff88807a3efe70 (&u->lock/1){+.+.}-{2:2}, at: unix_state_double_lock+0x77/0xa0 net/unix/af_unix.c:1290

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&u->lock/1){+.+.}-{2:2}:
       _raw_spin_lock_nested+0x30/0x40 kernel/locking/spinlock.c:378
       sk_diag_dump_icons net/unix/diag.c:87 [inline]
       sk_diag_fill+0xaaf/0x10d0 net/unix/diag.c:155
       sk_diag_dump net/unix/diag.c:193 [inline]
       unix_diag_dump+0x3a9/0x640 net/unix/diag.c:217
       netlink_dump+0x541/0xc20 net/netlink/af_netlink.c:2275
       __netlink_dump_start+0x647/0x900 net/netlink/af_netlink.c:2380
       netlink_dump_start include/linux/netlink.h:245 [inline]
       unix_diag_handler_dump net/unix/diag.c:315 [inline]
       unix_diag_handler_dump+0x5c2/0x830 net/unix/diag.c:304
       __sock_diag_cmd net/core/sock_diag.c:235 [inline]
       sock_diag_rcv_msg+0x31a/0x440 net/core/sock_diag.c:266
       netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2501
       sock_diag_rcv+0x26/0x40 net/core/sock_diag.c:277
       netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
       netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345
       netlink_sendmsg+0x917/0xe10 net/netlink/af_netlink.c:1921
       sock_sendmsg_nosec net/socket.c:714 [inline]
       sock_sendmsg+0xcf/0x120 net/socket.c:734
       sock_write_iter+0x291/0x3d0 net/socket.c:1108
       call_write_iter include/linux/fs.h:2187 [inline]
       do_iter_readv_writev+0x20b/0x3b0 fs/read_write.c:729
       do_iter_write+0x182/0x700 fs/read_write.c:855
       vfs_writev+0x1aa/0x630 fs/read_write.c:928
       do_writev+0x279/0x2f0 fs/read_write.c:971
       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+0x2f/0x70 arch/x86/entry/common.c:203
       entry_SYSENTER_compat_after_hwframe+0x70/0x82

-> #0 (rlock-AF_UNIX){+.+.}-{2:2}:
       check_prev_add kernel/locking/lockdep.c:3095 [inline]
       check_prevs_add kernel/locking/lockdep.c:3214 [inline]
       validate_chain kernel/locking/lockdep.c:3829 [inline]
       __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5053
       lock_acquire kernel/locking/lockdep.c:5666 [inline]
       lock_acquire+0x1ab/0x570 kernel/locking/lockdep.c:5631
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:162
       skb_queue_tail+0x21/0x140 net/core/skbuff.c:3400
       unix_dgram_sendmsg+0xf41/0x1b50 net/unix/af_unix.c:2043
       sock_sendmsg_nosec net/socket.c:714 [inline]
       sock_sendmsg+0xcf/0x120 net/socket.c:734
       io_send+0x290/0x7b0 io_uring/net.c:351
       io_issue_sqe+0x15e/0xd20 io_uring/io_uring.c:1577
       io_queue_sqe io_uring/io_uring.c:1755 [inline]
       io_submit_sqe io_uring/io_uring.c:2013 [inline]
       io_submit_sqes+0x94e/0x1d30 io_uring/io_uring.c:2124
       __do_sys_io_uring_enter+0xb85/0x1ea0 io_uring/io_uring.c:3057
       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+0x2f/0x70 arch/x86/entry/common.c:203
       entry_SYSENTER_compat_after_hwframe+0x70/0x82

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&u->lock/1);
                               lock(rlock-AF_UNIX);
                               lock(&u->lock/1);
  lock(rlock-AF_UNIX);

 *** DEADLOCK ***

2 locks held by syz-executor.2/31232:
 #0: ffff888058a660a8 (&ctx->uring_lock){+.+.}-{3:3}, at: __do_sys_io_uring_enter+0xb7a/0x1ea0 io_uring/io_uring.c:3056
 #1: ffff88807a3efe70 (&u->lock/1){+.+.}-{2:2}, at: unix_state_double_lock net/unix/af_unix.c:1298 [inline]
 #1: ffff88807a3efe70 (&u->lock/1){+.+.}-{2:2}, at: unix_state_double_lock+0x77/0xa0 net/unix/af_unix.c:1290

stack backtrace:
CPU: 1 PID: 31232 Comm: syz-executor.2 Not tainted 6.0.0-rc6-syzkaller-00321-g105a36f3694e #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2175
 check_prev_add kernel/locking/lockdep.c:3095 [inline]
 check_prevs_add kernel/locking/lockdep.c:3214 [inline]
 validate_chain kernel/locking/lockdep.c:3829 [inline]
 __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5053
 lock_acquire kernel/locking/lockdep.c:5666 [inline]
 lock_acquire+0x1ab/0x570 kernel/locking/lockdep.c:5631
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:162
 skb_queue_tail+0x21/0x140 net/core/skbuff.c:3400
 unix_dgram_sendmsg+0xf41/0x1b50 net/unix/af_unix.c:2043
 sock_sendmsg_nosec net/socket.c:714 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:734
 io_send+0x290/0x7b0 io_uring/net.c:351
 io_issue_sqe+0x15e/0xd20 io_uring/io_uring.c:1577
 io_queue_sqe io_uring/io_uring.c:1755 [inline]
 io_submit_sqe io_uring/io_uring.c:2013 [inline]
 io_submit_sqes+0x94e/0x1d30 io_uring/io_uring.c:2124
 __do_sys_io_uring_enter+0xb85/0x1ea0 io_uring/io_uring.c:3057
 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+0x2f/0x70 arch/x86/entry/common.c:203
 entry_SYSENTER_compat_after_hwframe+0x70/0x82
RIP: 0023:0xf7f6f549
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:00000000f7f6a5cc EFLAGS: 00000296 ORIG_RAX: 00000000000001aa
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000002a6e
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 000000000000000e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000296 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 (2):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-386 2022/09/25 13:03 upstream 105a36f3694e 0042f2b4 .config log report info possible deadlock in skb_queue_tail
ci-upstream-kasan-gce-386 2022/09/16 12:48 upstream 3245cb65fd91 dd9a85ff .config log report info possible deadlock in skb_queue_tail
* Struck through repros no longer work on HEAD.