syzbot


WARNING: refcount bug in sock_wfree
Status: fixed on 2020/04/20 22:55
Reported-by: syzbot+71367b0dcbec4249af38@syzkaller.appspotmail.com
Fix commit: 968f831d9056 sctp: fix refcount bug in sctp_wfree
First crash: 914d, last: 794d

Cause bisection: introduced by (bisect log) :
commit 2cb5c8e378d10a57aa1c9eaee36bea46c27dd2b9
Author: Neil Horman <nhorman@tuxdriver.com>
Date: Fri Jun 30 17:32:57 2017 +0000

  sctp: Add peeloff-flags socket option

Crash: WARNING: refcount bug in sctp_wfree (log)
Repro: C syz .config

Fix bisection: fixed by (bisect log) :
commit 968f831d9056bcb3fcca031c11d39f4853908307
Author: Qiujun Huang <hqjagain@gmail.com>
Date: Fri Mar 27 03:07:51 2020 +0000

  sctp: fix refcount bug in sctp_wfree

similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream WARNING: refcount bug in sock_wfree (2) C done 606 781d 954d 1/22 closed as invalid on 2020/06/27 23:36
linux-4.19 WARNING: refcount bug in sock_wfree C done done 1 794d 914d 1/1 fixed on 2020/04/20 22:55
upstream WARNING: refcount bug in sock_wfree syz error 24 1273d 1553d 0/22 closed as invalid on 2019/04/09 10:51

Sample crash report:
audit: type=1400 audit(1574446187.199:36): avc:  denied  { map } for  pid=6859 comm="syz-executor169" path="/root/syz-executor169903745" dev="sda1" ino=16483 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
ifb0: Invalid MTU 47872 requested, hw max 1500
refcount_t: underflow; use-after-free.
------------[ cut here ]------------
WARNING: CPU: 0 PID: 6859 at lib/refcount.c:187 refcount_sub_and_test lib/refcount.c:187 [inline]
WARNING: CPU: 0 PID: 6859 at lib/refcount.c:187 refcount_sub_and_test.cold+0x18/0x22 lib/refcount.c:177
Kernel panic - not syncing: panic_on_warn set ...

CPU: 0 PID: 6859 Comm: syz-executor169 Not tainted 4.14.155-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x142/0x197 lib/dump_stack.c:58
 panic+0x1f9/0x42d kernel/panic.c:183
 __warn.cold+0x2f/0x2f kernel/panic.c:547
 report_bug+0x216/0x254 lib/bug.c:186
 fixup_bug arch/x86/kernel/traps.c:177 [inline]
 fixup_bug arch/x86/kernel/traps.c:172 [inline]
 do_error_trap+0x1bb/0x310 arch/x86/kernel/traps.c:295
 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:314
 invalid_op+0x1b/0x40 arch/x86/entry/entry_64.S:963
RIP: 0010:refcount_sub_and_test lib/refcount.c:187 [inline]
RIP: 0010:refcount_sub_and_test.cold+0x18/0x22 lib/refcount.c:177
RSP: 0018:ffff88809f9df600 EFLAGS: 00010282
RAX: 0000000000000026 RBX: 0000000000008001 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff866d07c0 RDI: ffffed1013f3beb6
RBP: ffff88809f9df628 R08: 0000000000000026 R09: ffff888085586e48
R10: 0000000000000000 R11: 0000000000000000 R12: ffff88808b720a3c
R13: 0000000000008100 R14: 00000000ffffff01 R15: ffffffff88152e60
 sock_wfree+0xa7/0x160 net/core/sock.c:1812
 sctp_wfree+0x2a1/0x620 net/sctp/socket.c:7829
 skb_release_head_state+0x124/0x260 net/core/skbuff.c:616
 skb_release_all+0x16/0x60 net/core/skbuff.c:629
 __kfree_skb net/core/skbuff.c:645 [inline]
 consume_skb+0xaf/0x340 net/core/skbuff.c:705
 sctp_chunk_destroy net/sctp/sm_make_chunk.c:1442 [inline]
 sctp_chunk_put+0x179/0x270 net/sctp/sm_make_chunk.c:1469
 sctp_chunk_free+0x56/0x70 net/sctp/sm_make_chunk.c:1456
 __sctp_outq_teardown+0x1c2/0xde0 net/sctp/outqueue.c:228
 sctp_outq_free+0x16/0x20 net/sctp/outqueue.c:284
 sctp_association_free+0x1ee/0x753 net/sctp/associola.c:357
 sctp_cmd_delete_tcb net/sctp/sm_sideeffect.c:924 [inline]
 sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1312 [inline]
 sctp_side_effects net/sctp/sm_sideeffect.c:1179 [inline]
 sctp_do_sm+0x3469/0x4ae0 net/sctp/sm_sideeffect.c:1150
 sctp_primitive_ABORT+0xa0/0xd0 net/sctp/primitive.c:119
 sctp_close+0x25e/0x730 net/sctp/socket.c:1560
 inet_release+0xec/0x1c0 net/ipv4/af_inet.c:425
 __sock_release+0xce/0x2b0 net/socket.c:602
 sock_close+0x1b/0x30 net/socket.c:1139
 __fput+0x275/0x7a0 fs/file_table.c:210
 ____fput+0x16/0x20 fs/file_table.c:244
 task_work_run+0x114/0x190 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x7df/0x2c10 kernel/exit.c:874
 do_group_exit+0x111/0x330 kernel/exit.c:977
 SYSC_exit_group kernel/exit.c:988 [inline]
 SyS_exit_group+0x1d/0x20 kernel/exit.c:986
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x43f268
RSP: 002b:00007ffda6bffde8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000043f268
RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
RBP: 00000000004bea68 R08: 00000000000000e7 R09: ffffffffffffffd0
R10: 000000002059aff8 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000006d01a0 R14: 0000000000000000 R15: 0000000000000000
Kernel Offset: disabled
Rebooting in 86400 seconds..

Crashes (3):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2019/11/22 18:12 linux-4.14.y f56f3d0e65ad 598ca6c8 .config log report syz C
ci2-linux-4-14 2019/11/22 06:56 linux-4.14.y f56f3d0e65ad 8098ea0f .config log report syz C
ci2-linux-4-14 2019/11/22 04:27 linux-4.14.y f56f3d0e65ad 8098ea0f .config log report