WARNING: refcount bug in sock_wfree

34 views
Skip to first unread message

syzbot

unread,
Nov 22, 2019, 12:28:08 AM11/22/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: f56f3d0e Linux 4.14.155
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=15b41902e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=67c576af752ad9
dashboard link: https://syzkaller.appspot.com/bug?extid=71367b0dcbec4249af38
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+71367b...@syzkaller.appspotmail.com

refcount_t: underflow; use-after-free.
------------[ cut here ]------------
WARNING: CPU: 1 PID: 20099 at lib/refcount.c:187 refcount_sub_and_test
lib/refcount.c:187 [inline]
WARNING: CPU: 1 PID: 20099 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: 1 PID: 20099 Comm: syz-executor.1 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:ffff88808fcd7730 EFLAGS: 00010282
RAX: 0000000000000026 RBX: 0000000000008001 RCX: 0000000000000000
nla_parse: 17 callbacks suppressed
netlink: 100 bytes leftover after parsing attributes in process
`syz-executor.3'.
RDX: 0000000000000000 RSI: ffffffff869d1e80 RDI: ffffed1011f9aedc
RBP: ffff88808fcd7758 R08: 0000000000000026 R09: ffff888042f6ea48
R10: 0000000000000000 R11: 0000000000000000 R12: ffff8880508682bc
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
tracehook_notify_resume include/linux/tracehook.h:191 [inline]
exit_to_usermode_loop+0x1da/0x220 arch/x86/entry/common.c:164
prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
do_syscall_64+0x4bc/0x640 arch/x86/entry/common.c:297
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x4141d1
RSP: 002b:00007ffe2fb02780 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000009 RCX: 00000000004141d1
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000008
RBP: 0000000000000001 R08: 00000000ccd42ff8 R09: ffffffffffffffff
R10: 00007ffe2fb02860 R11: 0000000000000293 R12: 000000000075bf20
R13: 0000000000096ef0 R14: 0000000000760c10 R15: 000000000075bf2c
Kernel Offset: disabled
Rebooting in 86400 seconds..


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Nov 22, 2019, 1:57:09 AM11/22/19
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following crash on:

HEAD commit: f56f3d0e Linux 4.14.155
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=128503d2e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=67c576af752ad9
dashboard link: https://syzkaller.appspot.com/bug?extid=71367b0dcbec4249af38
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17aa42eee00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10593fbae00000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+71367b...@syzkaller.appspotmail.com

audit: type=1400 audit(1574405624.464:36): avc: denied { map } for
pid=6971 comm="syz-executor544" path="/root/syz-executor544635821"
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: 1 PID: 6971 at lib/refcount.c:187 refcount_sub_and_test
lib/refcount.c:187 [inline]
WARNING: CPU: 1 PID: 6971 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: 1 PID: 6971 Comm: syz-executor544 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:ffff888096d4f600 EFLAGS: 00010282
RAX: 0000000000000026 RBX: 0000000000008001 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff866d07c0 RDI: ffffed1012da9eb6
RBP: ffff888096d4f628 R08: 0000000000000026 R09: ffff8880a8f7adc8
R10: 0000000000000000 R11: 0000000000000000 R12: ffff888091512a3c
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:00007ffe90422508 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

syzbot

unread,
Nov 22, 2019, 9:42:10 AM11/22/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: c63ee293 Linux 4.19.85
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=168a638ce00000
kernel config: https://syzkaller.appspot.com/x/.config?x=cbfad1c8058581ad
dashboard link: https://syzkaller.appspot.com/bug?extid=59dc1aa392e0d829104b
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11c8436ae00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15f2958ce00000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+59dc1a...@syzkaller.appspotmail.com

audit: type=1400 audit(1574429880.357:35): avc: denied { map } for
pid=7746 comm="bash" path="/bin/bash" dev="sda1" ino=1457
scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1
audit: type=1400 audit(1574429887.077:36): avc: denied { map } for
pid=7758 comm="syz-executor818" path="/root/syz-executor818180628"
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
------------[ cut here ]------------
refcount_t: underflow; use-after-free.
WARNING: CPU: 1 PID: 7758 at lib/refcount.c:187
refcount_sub_and_test_checked lib/refcount.c:187 [inline]
WARNING: CPU: 1 PID: 7758 at lib/refcount.c:187
refcount_sub_and_test_checked+0x1c5/0x1f0 lib/refcount.c:177
Kernel panic - not syncing: panic_on_warn set ...

CPU: 1 PID: 7758 Comm: syz-executor818 Not tainted 4.19.85-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x197/0x210 lib/dump_stack.c:118
panic+0x26a/0x50e kernel/panic.c:186
__warn.cold+0x20/0x53 kernel/panic.c:541
report_bug+0x263/0x2b0 lib/bug.c:186
fixup_bug arch/x86/kernel/traps.c:178 [inline]
fixup_bug arch/x86/kernel/traps.c:173 [inline]
do_error_trap+0x204/0x360 arch/x86/kernel/traps.c:296
do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:316
invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:1037
RIP: 0010:refcount_sub_and_test_checked lib/refcount.c:187 [inline]
RIP: 0010:refcount_sub_and_test_checked+0x1c5/0x1f0 lib/refcount.c:177
Code: 1d 99 37 14 06 31 ff 89 de e8 d7 af 47 fe 84 db 75 1a e8 8e ae 47 fe
48 c7 c7 80 2c 82 87 c6 05 79 37 14 06 01 e8 d9 2c 1b fe <0f> 0b 45 31 e4
eb 90 e8 6f ae 47 fe e9 ce fe ff ff 48 89 df e8 12
RSP: 0018:ffff88809e6e7550 EFLAGS: 00010286
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff815595d6 RDI: ffffed1013cdce9c
RBP: ffff88809e6e75e0 R08: ffff88809fca4540 R09: ffffed1015d23ee3
R10: ffffed1015d23ee2 R11: ffff8880ae91f717 R12: 00000000ffffff01
R13: 0000000000008001 R14: 1ffff11013cdceab R15: ffff88809e6e75b8
sock_wfree+0xb6/0x180 net/core/sock.c:1819
sctp_wfree+0x395/0x960 net/sctp/socket.c:8467
skb_release_head_state+0x15d/0x2d0 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 net/core/skbuff.c:705 [inline]
consume_skb+0xe2/0x380 net/core/skbuff.c:699
sctp_chunk_destroy net/sctp/sm_make_chunk.c:1467 [inline]
sctp_chunk_put+0x192/0x280 net/sctp/sm_make_chunk.c:1494
sctp_chunk_free+0x56/0x70 net/sctp/sm_make_chunk.c:1481
__sctp_outq_teardown+0x1d0/0xc60 net/sctp/outqueue.c:234
sctp_outq_free+0x16/0x20 net/sctp/outqueue.c:291
sctp_association_free+0x208/0x79a net/sctp/associola.c:360
sctp_cmd_delete_tcb net/sctp/sm_sideeffect.c:944 [inline]
sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1332 [inline]
sctp_side_effects net/sctp/sm_sideeffect.c:1199 [inline]
sctp_do_sm+0x3a73/0x5190 net/sctp/sm_sideeffect.c:1170
sctp_primitive_ABORT+0xa0/0xd0 net/sctp/primitive.c:119
sctp_close+0x259/0x860 net/sctp/socket.c:1558
inet_release+0xff/0x1e0 net/ipv4/af_inet.c:428
__sock_release+0xce/0x2a0 net/socket.c:579
sock_close+0x1b/0x30 net/socket.c:1140
__fput+0x2dd/0x8b0 fs/file_table.c:278
____fput+0x16/0x20 fs/file_table.c:309
task_work_run+0x145/0x1c0 kernel/task_work.c:113
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0x994/0x2fa0 kernel/exit.c:876
do_group_exit+0x135/0x370 kernel/exit.c:979
__do_sys_exit_group kernel/exit.c:990 [inline]
__se_sys_exit_group kernel/exit.c:988 [inline]
__x64_sys_exit_group+0x44/0x50 kernel/exit.c:988
do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x43f268
Code: Bad RIP value.
RSP: 002b:00007ffe2bf71e18 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..


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Nov 23, 2019, 2:47:02 PM11/23/19
to syzkaller...@googlegroups.com
syzbot has bisected this bug to:

commit 2cb5c8e378d10a57aa1c9eaee36bea46c27dd2b9
Author: Neil Horman <nho...@tuxdriver.com>
Date: Fri Jun 30 17:32:57 2017 +0000

sctp: Add peeloff-flags socket option

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=16fd009ce00000
start commit: f56f3d0e Linux 4.14.155
git tree: linux-4.14.y
final crash: https://syzkaller.appspot.com/x/report.txt?x=15fd009ce00000
console output: https://syzkaller.appspot.com/x/log.txt?x=11fd009ce00000
Reported-by: syzbot+71367b...@syzkaller.appspotmail.com
Fixes: 2cb5c8e378d1 ("sctp: Add peeloff-flags socket option")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

syzbot

unread,
Nov 24, 2019, 6:07:02 AM11/24/19
to syzkaller...@googlegroups.com
syzbot has bisected this bug to:

commit cbf23d40cece0a1631c5b6b4bcc937f49650439f
Author: Xin Long <lucie...@gmail.com>
Date: Mon Jan 21 18:42:09 2019 +0000

sctp: set chunk transport correctly when it's a new asoc

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=102fbbd2e00000
start commit: c63ee293 Linux 4.19.85
git tree: linux-4.19.y
final crash: https://syzkaller.appspot.com/x/report.txt?x=122fbbd2e00000
console output: https://syzkaller.appspot.com/x/log.txt?x=142fbbd2e00000
Reported-by: syzbot+59dc1a...@syzkaller.appspotmail.com
Fixes: cbf23d40cece ("sctp: set chunk transport correctly when it's a new
asoc")

syzbot

unread,
Apr 20, 2020, 2:49:04 PM4/20/20
to syzkaller...@googlegroups.com
syzbot suspects this bug was fixed by commit:

commit 6ce6aea362d46781d4f5f03cfda16f0a395445d2
Author: Qiujun Huang <hqja...@gmail.com>
Date: Fri Mar 27 03:07:51 2020 +0000

sctp: fix refcount bug in sctp_wfree

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=145ed927e00000
start commit: c63ee293 Linux 4.19.85
git tree: linux-4.19.y
If the result looks correct, please mark the bug fixed by replying with:

#syz fix: sctp: fix refcount bug in sctp_wfree

syzbot

unread,
Apr 20, 2020, 6:51:03 PM4/20/20
to syzkaller...@googlegroups.com
syzbot suspects this bug was fixed by commit:

commit 968f831d9056bcb3fcca031c11d39f4853908307
Author: Qiujun Huang <hqja...@gmail.com>
Date: Fri Mar 27 03:07:51 2020 +0000

sctp: fix refcount bug in sctp_wfree

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=10d55627e00000
start commit: f56f3d0e Linux 4.14.155
git tree: linux-4.14.y
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=125f5122e00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1002bf3ce00000
Reply all
Reply to author
Forward
0 new messages