syzbot


WARNING: refcount bug in put_gid_ndev

Status: upstream: reported on 2022/12/09 08:33
Reported-by: syzbot+8d0a099c8a6d1e4e601c@syzkaller.appspotmail.com
Fix commit: e42f9c2e6aad RDMA: Add missed netdev_put() for the netdevice_tracker
Patched on: [ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-arm64 ci-upstream-gce-leak ci-upstream-kasan-gce ci-upstream-kasan-gce-386 ci-upstream-kasan-gce-root ci-upstream-kasan-gce-selinux-root ci-upstream-kasan-gce-smack-root ci-upstream-kmsan-gce ci-upstream-kmsan-gce-386 ci-upstream-linux-next-kasan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-usb], missing on: [ci-qemu2-riscv64]
First crash: 60d, last: 59d

Sample crash report:
------------[ cut here ]------------
refcount_t: decrement hit 0; leaking memory.
WARNING: CPU: 0 PID: 14632 at lib/refcount.c:31 refcount_warn_saturate+0x1d7/0x1f0 lib/refcount.c:31
Modules linked in:
CPU: 0 PID: 14632 Comm: syz-executor.0 Not tainted 6.1.0-rc8-next-20221207-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
RIP: 0010:refcount_warn_saturate+0x1d7/0x1f0 lib/refcount.c:31
Code: 05 5a 60 51 0a 01 e8 35 0a b5 05 0f 0b e9 d3 fe ff ff e8 6c 9b 75 fd 48 c7 c7 c0 6d a6 8a c6 05 37 60 51 0a 01 e8 16 0a b5 05 <0f> 0b e9 b4 fe ff ff 48 89 ef e8 5a b5 c3 fd e9 5c fe ff ff 0f 1f
RSP: 0018:ffffc90000007ce8 EFLAGS: 00010282
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: ffff8880498c57c0 RSI: ffffffff8166b1dc RDI: fffff52000000f8f
RBP: ffff88804bd6a600 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000100 R11: 0000000000000001 R12: 1ffff92000000fa2
R13: 0000000000000000 R14: ffff88804bd6a600 R15: 0000000000000006
FS:  00007fa7f51c1700(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000202c0030 CR3: 0000000022a40000 CR4: 00000000003506f0
DR0: 00000000ffff070c DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Call Trace:
 <IRQ>
 __refcount_dec include/linux/refcount.h:344 [inline]
 refcount_dec include/linux/refcount.h:359 [inline]
 ref_tracker_free+0x539/0x6b0 lib/ref_tracker.c:118
 netdev_tracker_free include/linux/netdevice.h:4039 [inline]
 netdev_put include/linux/netdevice.h:4056 [inline]
 dev_put include/linux/netdevice.h:4082 [inline]
 put_gid_ndev+0x5a/0xc0 drivers/infiniband/core/cache.c:233
 rcu_do_batch kernel/rcu/tree.c:2244 [inline]
 rcu_core+0x81f/0x1980 kernel/rcu/tree.c:2504
 __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
 sysvec_apic_timer_interrupt+0x97/0xc0 arch/x86/kernel/apic/apic.c:1107
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:649
RIP: 0010:iovec_from_user lib/iov_iter.c:1781 [inline]
RIP: 0010:iovec_from_user+0x180/0x420 lib/iov_iter.c:1752
Code: ee 0f 83 2b 01 00 00 48 c7 c5 f2 ff ff ff e8 57 b8 76 fd 4c 39 6c 24 10 74 0d e8 4b b8 76 fd 4c 89 ef e8 43 14 ac fd 49 89 ed <e8> 3b b8 76 fd 4c 89 e8 48 83 c4 18 5b 5d 41 5c 41 5d 41 5e 41 5f
RSP: 0018:ffffc90005017960 EFLAGS: 00000246
RAX: 0000000000000002 RBX: 0000000000000000 RCX: ffffffff840ae978
RDX: ffff8880498c57c0 RSI: 0000000000000000 RDI: 0000000000000007
RBP: 0000000000000008 R08: 0000000000000007 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: ffffc90005017bc0 R14: 0000000000000000 R15: ffffc90005017bc0
 __import_iovec+0x74/0x6a0 lib/iov_iter.c:1795
 import_iovec+0x110/0x160 lib/iov_iter.c:1860
 copy_msghdr_from_user+0xed/0x150 net/socket.c:2414
 recvmsg_copy_msghdr net/socket.c:2661 [inline]
 ___sys_recvmsg+0xbc/0x180 net/socket.c:2733
 do_recvmmsg+0x264/0x7b0 net/socket.c:2831
 __sys_recvmmsg net/socket.c:2910 [inline]
 __do_sys_recvmmsg net/socket.c:2933 [inline]
 __se_sys_recvmmsg net/socket.c:2926 [inline]
 __x64_sys_recvmmsg+0x20f/0x260 net/socket.c:2926
 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:0x7fa7f448c0d9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fa7f51c1168 EFLAGS: 00000246 ORIG_RAX: 000000000000012b
RAX: ffffffffffffffda RBX: 00007fa7f45ac120 RCX: 00007fa7f448c0d9
RDX: 0000000000010106 RSI: 00000000200000c0 RDI: 0000000000000003
RBP: 00007fa7f44e7ae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffd488ccb6f R14: 00007fa7f51c1300 R15: 0000000000022000
 </TASK>
----------------
Code disassembly (best guess):
   0:	ee                   	out    %al,(%dx)
   1:	0f 83 2b 01 00 00    	jae    0x132
   7:	48 c7 c5 f2 ff ff ff 	mov    $0xfffffffffffffff2,%rbp
   e:	e8 57 b8 76 fd       	callq  0xfd76b86a
  13:	4c 39 6c 24 10       	cmp    %r13,0x10(%rsp)
  18:	74 0d                	je     0x27
  1a:	e8 4b b8 76 fd       	callq  0xfd76b86a
  1f:	4c 89 ef             	mov    %r13,%rdi
  22:	e8 43 14 ac fd       	callq  0xfdac146a
  27:	49 89 ed             	mov    %rbp,%r13
* 2a:	e8 3b b8 76 fd       	callq  0xfd76b86a <-- trapping instruction
  2f:	4c 89 e8             	mov    %r13,%rax
  32:	48 83 c4 18          	add    $0x18,%rsp
  36:	5b                   	pop    %rbx
  37:	5d                   	pop    %rbp
  38:	41 5c                	pop    %r12
  3a:	41 5d                	pop    %r13
  3c:	41 5e                	pop    %r14
  3e:	41 5f                	pop    %r15

Crashes (3):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-linux-next-kasan-gce-root 2022/12/09 15:29 linux-next 591cd61541b9 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] WARNING: refcount bug in put_gid_ndev
ci-upstream-linux-next-kasan-gce-root 2022/12/08 17:14 linux-next 591cd61541b9 1034e5fa .config console log report info [disk image] [vmlinux] [kernel image] WARNING: refcount bug in put_gid_ndev
ci-upstream-linux-next-kasan-gce-root 2022/12/08 14:21 linux-next 591cd61541b9 1034e5fa .config console log report info [disk image] [vmlinux] [kernel image] WARNING: refcount bug in put_gid_ndev
* Struck through repros no longer work on HEAD.