syzbot


WARNING: refcount bug in j1939_session_put

Status: upstream: reported C repro on 2024/08/05 21:18
Subsystems: can
[Documentation on labels]
Reported-by: syzbot+ad601904231505ad6617@syzkaller.appspotmail.com
First crash: 41d, last: 1h36m
Cause bisection: introduced by (bisect log) :
commit c9c0ee5f20c593faf289fa8850c3ed84031dd12a
Author: Breno Leitao <leitao@debian.org>
Date: Mon Jul 29 10:47:40 2024 +0000

  net: skbuff: Skip early return in skb_unref when debugging

Crash: WARNING: refcount bug in j1939_session_put (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[PATCH net-next] can: j1939: fix uaf in j1939_session_destroy 6 (6) 2024/08/08 11:57
[syzbot] [can?] WARNING: refcount bug in j1939_session_put 13 (24) 2024/08/07 23:06
Last patch testing requests (11)
Created Duration User Patch Repo Result
2024/08/07 11:00 58m eadavis@qq.com patch git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 743ff02152bc OK log
2024/08/07 09:29 49m eadavis@qq.com patch git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 743ff02152bc OK log
2024/08/07 08:30 42m eadavis@qq.com upstream OK log
2024/08/07 06:56 1h23m eadavis@qq.com patch git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 743ff02152bc OK log
2024/08/07 06:21 17m eadavis@qq.com patch git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 743ff02152bc report log
2024/08/07 02:39 25m eadavis@qq.com patch git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 743ff02152bc OK log
2024/08/07 01:42 16m eadavis@qq.com patch git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 743ff02152bc report log
2024/08/07 01:19 16m eadavis@qq.com patch git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 743ff02152bc report log
2024/08/07 00:56 24m eadavis@qq.com patch git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 743ff02152bc OK log
2024/08/06 13:39 24m eadavis@qq.com patch git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 743ff02152bc OK log
2024/08/06 13:13 18m eadavis@qq.com patch git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 743ff02152bc report log

Sample crash report:
------------[ cut here ]------------
refcount_t: underflow; use-after-free.
WARNING: CPU: 0 PID: 5233 at lib/refcount.c:28 refcount_warn_saturate+0x15a/0x1d0 lib/refcount.c:28
Modules linked in:
CPU: 0 UID: 0 PID: 5233 Comm: syz-executor339 Not tainted 6.10.0-syzkaller-12610-g743ff02152bc #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024
RIP: 0010:refcount_warn_saturate+0x15a/0x1d0 lib/refcount.c:28
Code: 00 17 40 8c e8 67 97 a5 fc 90 0f 0b 90 90 eb 99 e8 1b 89 e3 fc c6 05 76 7d 31 0b 01 90 48 c7 c7 60 17 40 8c e8 47 97 a5 fc 90 <0f> 0b 90 90 e9 76 ff ff ff e8 f8 88 e3 fc c6 05 50 7d 31 0b 01 90
RSP: 0018:ffffc900000076a0 EFLAGS: 00010246
RAX: adacdd6de1fa9d00 RBX: ffff88802c47c224 RCX: ffff8880234fda00
RDX: 0000000080000101 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000003 R08: ffffffff81559432 R09: 1ffff1101724519a
R10: dffffc0000000000 R11: ffffed101724519b R12: ffff88807d01a468
R13: ffff88802c47c224 R14: 1ffff1100fa03498 R15: ffff88807d01a400
FS:  0000555569709380(0000) GS:ffff8880b9200000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000000 CR3: 000000001eb56000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <IRQ>
 kfree_skb_reason include/linux/skbuff.h:1260 [inline]
 kfree_skb include/linux/skbuff.h:1269 [inline]
 j1939_session_destroy net/can/j1939/transport.c:282 [inline]
 __j1939_session_release net/can/j1939/transport.c:294 [inline]
 kref_put include/linux/kref.h:65 [inline]
 j1939_session_put+0x1e7/0x440 net/can/j1939/transport.c:299
 j1939_tp_cmd_recv net/can/j1939/transport.c:2113 [inline]
 j1939_tp_recv+0x7fe/0x1050 net/can/j1939/transport.c:2161
 j1939_can_recv+0x732/0xb20 net/can/j1939/main.c:108
 deliver net/can/af_can.c:572 [inline]
 can_rcv_filter+0x359/0x7f0 net/can/af_can.c:606
 can_receive+0x31c/0x470 net/can/af_can.c:663
 can_rcv+0x144/0x260 net/can/af_can.c:687
 __netif_receive_skb_one_core net/core/dev.c:5660 [inline]
 __netif_receive_skb+0x2e0/0x650 net/core/dev.c:5774
 process_backlog+0x662/0x15b0 net/core/dev.c:6107
 __napi_poll+0xcb/0x490 net/core/dev.c:6771
 napi_poll net/core/dev.c:6840 [inline]
 net_rx_action+0x89b/0x1240 net/core/dev.c:6962
 handle_softirqs+0x2c4/0x970 kernel/softirq.c:554
 __do_softirq kernel/softirq.c:588 [inline]
 invoke_softirq kernel/softirq.c:428 [inline]
 __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637
 irq_exit_rcu+0x9/0x30 kernel/softirq.c:649
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline]
 sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1043
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0xd8/0x140 kernel/locking/spinlock.c:194
Code: 9c 8f 44 24 20 42 80 3c 23 00 74 08 4c 89 f7 e8 0e 9c 3b f6 f6 44 24 21 02 75 52 41 f7 c7 00 02 00 00 74 01 fb bf 01 00 00 00 <e8> 63 c1 a3 f5 65 8b 05 64 b7 44 74 85 c0 74 43 48 c7 04 24 0e 36
RSP: 0018:ffffc900035378c0 EFLAGS: 00000206
RAX: adacdd6de1fa9d00 RBX: 1ffff920006a6f1c RCX: ffffffff81701f3a
RDX: dffffc0000000000 RSI: ffffffff8bead5a0 RDI: 0000000000000001
RBP: ffffc90003537950 R08: ffffffff9351e8e7 R09: 1ffffffff26a3d1c
R10: dffffc0000000000 R11: fffffbfff26a3d1d R12: dffffc0000000000
R13: 1ffff920006a6f18 R14: ffffc900035378e0 R15: 0000000000000246
 j1939_sk_send_loop net/can/j1939/socket.c:1164 [inline]
 j1939_sk_sendmsg+0xe01/0x14c0 net/can/j1939/socket.c:1277
 sock_sendmsg_nosec net/socket.c:730 [inline]
 __sock_sendmsg+0x221/0x270 net/socket.c:745
 ____sys_sendmsg+0x525/0x7d0 net/socket.c:2597
 ___sys_sendmsg net/socket.c:2651 [inline]
 __sys_sendmsg+0x2b0/0x3a0 net/socket.c:2680
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fd558d90e09
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 01 1a 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:00007ffe518919c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fd558d90e09
RDX: 0000000000000000 RSI: 0000000020000280 RDI: 0000000000000003
RBP: 00000000000f4240 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffe51891a20
R13: 00007fd558dde406 R14: 0000000000000003 R15: 00007ffe51891a00
 </TASK>
----------------
Code disassembly (best guess):
   0:	9c                   	pushf
   1:	8f 44 24 20          	pop    0x20(%rsp)
   5:	42 80 3c 23 00       	cmpb   $0x0,(%rbx,%r12,1)
   a:	74 08                	je     0x14
   c:	4c 89 f7             	mov    %r14,%rdi
   f:	e8 0e 9c 3b f6       	call   0xf63b9c22
  14:	f6 44 24 21 02       	testb  $0x2,0x21(%rsp)
  19:	75 52                	jne    0x6d
  1b:	41 f7 c7 00 02 00 00 	test   $0x200,%r15d
  22:	74 01                	je     0x25
  24:	fb                   	sti
  25:	bf 01 00 00 00       	mov    $0x1,%edi
* 2a:	e8 63 c1 a3 f5       	call   0xf5a3c192 <-- trapping instruction
  2f:	65 8b 05 64 b7 44 74 	mov    %gs:0x7444b764(%rip),%eax        # 0x7444b79a
  36:	85 c0                	test   %eax,%eax
  38:	74 43                	je     0x7d
  3a:	48                   	rex.W
  3b:	c7                   	.byte 0xc7
  3c:	04 24                	add    $0x24,%al
  3e:	0e                   	(bad)
  3f:	36                   	ss

Crashes (2077):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/08/02 10:12 net-next 743ff02152bc 1e9c4cf3 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/08/02 08:41 net-next 743ff02152bc 1e9c4cf3 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/08/02 07:20 net-next 743ff02152bc 1e9c4cf3 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/08/02 05:23 net-next 743ff02152bc 1e9c4cf3 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/08/02 03:11 net-next 743ff02152bc 1e9c4cf3 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/08/02 01:57 net-next 743ff02152bc 1e9c4cf3 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/12 12:14 net-next 3cfb5aa10cb7 60e1a995 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/12 11:12 net-next 3cfb5aa10cb7 60e1a995 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/12 07:27 net-next bf73478b539b d94c83d8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/12 06:13 net-next bf73478b539b d94c83d8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/12 03:11 net-next bf73478b539b d94c83d8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/12 00:30 net-next bf73478b539b d94c83d8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/11 23:08 net-next bf73478b539b d94c83d8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/11 18:58 net-next f3b6129b7d25 9326a104 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/11 17:10 net-next f3b6129b7d25 9326a104 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/11 15:10 net-next f3b6129b7d25 9326a104 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/11 14:40 net-next f3b6129b7d25 9326a104 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/11 13:18 net-next f3b6129b7d25 9326a104 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/11 09:47 net-next f3b6129b7d25 9326a104 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/11 06:30 net-next 525034e2e2ee 79eef296 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/11 03:06 net-next 525034e2e2ee 79eef296 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/11 01:08 net-next 525034e2e2ee 79eef296 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/10 20:44 net-next 525034e2e2ee 79eef296 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/10 18:08 net-next a9b1fab3b69f 784df80e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/10 16:05 net-next a9b1fab3b69f 784df80e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/10 15:05 net-next a9b1fab3b69f 784df80e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/10 11:06 net-next a9b1fab3b69f 784df80e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/10 11:05 net-next a9b1fab3b69f 784df80e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/10 09:05 net-next a9b1fab3b69f 784df80e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/10 06:42 net-next a9b1fab3b69f 784df80e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/10 05:34 net-next a9b1fab3b69f dd9c7e97 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/10 03:37 net-next bfba7bc8b7c2 dd9c7e97 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/10 03:00 net-next bfba7bc8b7c2 dd9c7e97 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/10 00:27 net-next bfba7bc8b7c2 dd9c7e97 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/09 23:09 net-next bfba7bc8b7c2 dd9c7e97 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/09 23:00 net-next bfba7bc8b7c2 dd9c7e97 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/09 20:29 net-next bfba7bc8b7c2 dd9c7e97 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/09 17:22 net-next bfba7bc8b7c2 dd9c7e97 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/09 15:54 net-next bfba7bc8b7c2 dd9c7e97 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/09 14:48 net-next bfba7bc8b7c2 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/09 14:47 net-next bfba7bc8b7c2 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/09 12:15 net-next c259acab839e 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/09 11:04 net-next c259acab839e 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/09 08:45 net-next c259acab839e 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/09 06:52 net-next c259acab839e 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/09 05:02 net-next c259acab839e 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/09 04:02 net-next c259acab839e 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/09 02:32 net-next c259acab839e 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/08 18:18 net-next d5c4546062fd 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/08 16:07 net-next d5c4546062fd 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/09/08 13:14 net-next d5c4546062fd 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/08/01 21:15 net-next 743ff02152bc 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce WARNING: refcount bug in j1939_session_put
2024/08/23 07:10 linux-next c79c85875f1a ce8a9099 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root WARNING: refcount bug in j1939_session_put
* Struck through repros no longer work on HEAD.