syzbot


KASAN: use-after-free Read in sctp_association_free

Status: fixed on 2018/02/01 10:32
Subsystems: sctp
[Documentation on labels]
Reported-by: syzbot+df9412138a14678abd73a2b70a57241f63563ed1@syzkaller.appspotmail.com
Fix commit: ca3af4dd28cf sctp: do not free asoc when it is already dead in sctp_sendmsg
First crash: 2429d, last: 2404d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in sctp_association_free (2) sctp C 2 2291d 2291d 5/27 fixed on 2018/05/08 18:30

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in sctp_association_free+0x7b7/0x930 net/sctp/associola.c:333
Read of size 8 at addr ffff8801d21d4720 by task syzkaller504854/3007

CPU: 0 PID: 3007 Comm: syzkaller504854 Not tainted 4.14.0-rc6+ #62
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:16 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:52
 print_address_description+0x73/0x250 mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report+0x25b/0x340 mm/kasan/report.c:409
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
 sctp_association_free+0x7b7/0x930 net/sctp/associola.c:333
 sctp_sendmsg+0x2311/0x31f0 net/sctp/socket.c:2011
 inet_sendmsg+0x11f/0x5e0 net/ipv4/af_inet.c:762
 sock_sendmsg_nosec net/socket.c:633 [inline]
 sock_sendmsg+0xca/0x110 net/socket.c:643
 SYSC_sendto+0x352/0x5a0 net/socket.c:1750
 SyS_sendto+0x40/0x50 net/socket.c:1718
 do_syscall_32_irqs_on arch/x86/entry/common.c:329 [inline]
 do_fast_syscall_32+0x3f2/0xf05 arch/x86/entry/common.c:391
 entry_SYSENTER_compat+0x51/0x60 arch/x86/entry/entry_64_compat.S:124
RIP: 0023:0xf7fd2c79
RSP: 002b:00000000f5fca1ec EFLAGS: 00000292 ORIG_RAX: 0000000000000171
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000020925000
RDX: 0000000000000002 RSI: 0000000000000000 RDI: 00000000209e1000
RBP: 000000000000001c R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 3007:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551
 kmem_cache_alloc_trace+0x136/0x750 mm/slab.c:3627
 kmalloc include/linux/slab.h:493 [inline]
 kzalloc include/linux/slab.h:666 [inline]
 sctp_association_new+0x114/0x21e0 net/sctp/associola.c:309
 sctp_sendmsg+0x128c/0x31f0 net/sctp/socket.c:1838
 inet_sendmsg+0x11f/0x5e0 net/ipv4/af_inet.c:762
 sock_sendmsg_nosec net/socket.c:633 [inline]
 sock_sendmsg+0xca/0x110 net/socket.c:643
 SYSC_sendto+0x352/0x5a0 net/socket.c:1750
 SyS_sendto+0x40/0x50 net/socket.c:1718
 do_syscall_32_irqs_on arch/x86/entry/common.c:329 [inline]
 do_fast_syscall_32+0x3f2/0xf05 arch/x86/entry/common.c:391
 entry_SYSENTER_compat+0x51/0x60 arch/x86/entry/entry_64_compat.S:124

Freed by task 3007:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xca/0x250 mm/slab.c:3820
 sctp_association_destroy net/sctp/associola.c:435 [inline]
 sctp_association_put+0x21c/0x2f0 net/sctp/associola.c:884
 sctp_wait_for_sndbuf+0x5e3/0x7c0 net/sctp/socket.c:7836
 sctp_sendmsg+0x2750/0x31f0 net/sctp/socket.c:1935
 inet_sendmsg+0x11f/0x5e0 net/ipv4/af_inet.c:762
 sock_sendmsg_nosec net/socket.c:633 [inline]
 sock_sendmsg+0xca/0x110 net/socket.c:643
 SYSC_sendto+0x352/0x5a0 net/socket.c:1750
 SyS_sendto+0x40/0x50 net/socket.c:1718
 do_syscall_32_irqs_on arch/x86/entry/common.c:329 [inline]
 do_fast_syscall_32+0x3f2/0xf05 arch/x86/entry/common.c:391
 entry_SYSENTER_compat+0x51/0x60 arch/x86/entry/entry_64_compat.S:124

The buggy address belongs to the object at ffff8801d21d4700
 which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 32 bytes inside of
 4096-byte region [ffff8801d21d4700, ffff8801d21d5700)
The buggy address belongs to the page:
page:ffffea0007487500 count:1 mapcount:0 mapping:ffff8801d21d4700 index:0x0 compound_mapcount: 0
flags: 0x200000000008100(slab|head)
raw: 0200000000008100 ffff8801d21d4700 0000000000000000 0000000100000001
raw: ffffea0007487420 ffff8801dac01a48 ffff8801dac00dc0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801d21d4600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8801d21d4680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8801d21d4700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff8801d21d4780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801d21d4800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (20):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2017/10/29 18:58 upstream 25a5d23b4799 80c74880 .config console log report syz C ci-upstream-kasan-gce
2017/10/29 18:57 upstream 25a5d23b4799 80c74880 .config console log report syz C ci-upstream-kasan-gce
2017/10/29 18:56 net-next-old aad93c70b9a3 80c74880 .config console log report syz C ci-upstream-net-kasan-gce
2017/10/30 01:04 linux-next 36ef71cae353 e511d9f8 .config console log report syz C ci-upstream-next-kasan-gce
2017/10/29 18:57 mmots 0f611fb6dcc0 e0a2b195 .config console log report syz C ci-upstream-mmots-kasan-gce
2017/10/29 18:39 linux-next 36ef71cae353 e511d9f8 .config console log report syz C ci-upstream-next-kasan-gce
2017/11/08 05:27 upstream fbc3edf7d773 9547ae3a .config console log report ci-upstream-kasan-gce
2017/10/23 01:35 net-next-old f8ddadc4db6c ab829b1b .config console log report ci-upstream-net-kasan-gce
2017/11/17 01:56 linux-next 785be731fbc6 348d8f13 .config console log report ci-upstream-next-kasan-gce
2017/11/15 00:34 linux-next c9b945f2a731 cf38de00 .config console log report ci-upstream-next-kasan-gce
2017/11/14 02:46 linux-next c348a99ee55f f9a8d567 .config console log report ci-upstream-next-kasan-gce
2017/11/13 23:15 linux-next c348a99ee55f f9a8d567 .config console log report ci-upstream-next-kasan-gce
2017/11/12 01:15 linux-next d9e0e63d9a6f e0a2b195 .config console log report ci-upstream-next-kasan-gce
2017/11/10 21:52 linux-next d9e0e63d9a6f e0a2b195 .config console log report ci-upstream-next-kasan-gce
2017/11/10 15:26 linux-next d9e0e63d9a6f e0a2b195 .config console log report ci-upstream-next-kasan-gce
2017/11/10 01:24 linux-next 5515cf16e270 e0a2b195 .config console log report ci-upstream-next-kasan-gce
2017/11/03 02:28 linux-next fa8785e862ef 02b8363d .config console log report skylake-linux-next-kasan-qemu
2017/11/01 08:50 linux-next 36ef71cae353 e511d9f8 .config console log report ci-upstream-next-kasan-gce
2017/10/31 22:33 linux-next 36ef71cae353 e511d9f8 .config console log report ci-upstream-next-kasan-gce
2017/10/29 17:31 linux-next 36ef71cae353 e511d9f8 .config console log report ci-upstream-next-kasan-gce
* Struck through repros no longer work on HEAD.