syzbot


KASAN: use-after-free Read in tipc_send_group_bcast

Status: fixed on 2017/11/28 03:36
Subsystems: tipc
[Documentation on labels]
Reported-by: syzbot+e1bc716eea32bd67d0cedfcfda72362454782c57@syzkaller.appspotmail.com
Fix commit: e233df01576b tipc: fix a dangling pointer
First crash: 2351d, last: 2347d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in tipc_send_group_bcast+0xb08/0xcf0 net/tipc/socket.c:1021
sctp: [Deprecated]: syz-executor7 (pid 9571) Use of int in max_burst socket option.
Use struct sctp_assoc_value instead
Read of size 1 at addr ffff8801c8db025e by task syz-executor6/9579

CPU: 1 PID: 9579 Comm: syz-executor6 Not tainted 4.14.0-rc5+ #90
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_load1_noabort+0x14/0x20 mm/kasan/report.c:427
 tipc_send_group_bcast+0xb08/0xcf0 net/tipc/socket.c:1021
 __tipc_sendmsg+0xc97/0x1b20 net/tipc/socket.c:1284
 tipc_sendmsg+0x50/0x70 net/tipc/socket.c:1249
 sock_sendmsg_nosec net/socket.c:633 [inline]
 sock_sendmsg+0xca/0x110 net/socket.c:643
 sock_write_iter+0x31a/0x5d0 net/socket.c:912
 call_write_iter include/linux/fs.h:1770 [inline]
 new_sync_write fs/read_write.c:468 [inline]
 __vfs_write+0x684/0x970 fs/read_write.c:481
 vfs_write+0x189/0x510 fs/read_write.c:543
 SYSC_write fs/read_write.c:588 [inline]
 SyS_write+0xef/0x220 fs/read_write.c:580
 entry_SYSCALL_64_fastpath+0x1f/0xbe
RIP: 0033:0x452869
RSP: 002b:00007f27271c6be8 EFLAGS: 00000212 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000758020 RCX: 0000000000452869
RDX: 00000000000000fa RSI: 0000000020003000 RDI: 0000000000000014
RBP: 00000000000003d9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000212 R12: 00000000006f3cf8
R13: 00000000ffffffff R14: 00007f27271c76d4 R15: 0000000000000000

Allocated by task 9579:
 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]
 tipc_group_create+0x116/0x9c0 net/tipc/group.c:167
 tipc_sk_join net/tipc/socket.c:2747 [inline]
 tipc_setsockopt+0x25e/0xc00 net/tipc/socket.c:2859
 SYSC_setsockopt net/socket.c:1852 [inline]
 SyS_setsockopt+0x189/0x360 net/socket.c:1831
 entry_SYSCALL_64_fastpath+0x1f/0xbe

Freed by task 9579:
 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
 tipc_group_delete+0x2c0/0x3c0 net/tipc/group.c:206
 tipc_sk_join net/tipc/socket.c:2760 [inline]
 tipc_setsockopt+0xb33/0xc00 net/tipc/socket.c:2859
 SYSC_setsockopt net/socket.c:1852 [inline]
 SyS_setsockopt+0x189/0x360 net/socket.c:1831
 entry_SYSCALL_64_fastpath+0x1f/0xbe

The buggy address belongs to the object at ffff8801c8db0200
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 94 bytes inside of
 192-byte region [ffff8801c8db0200, ffff8801c8db02c0)
The buggy address belongs to the page:
page:ffffea0007236c00 count:1 mapcount:0 mapping:ffff8801c8db0000 index:0x0
flags: 0x200000000000100(slab)
raw: 0200000000000100 ffff8801c8db0000 0000000000000000 0000000100000010
raw: ffffea00062d6f20 ffffea000753a160 ffff8801dac00040 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801c8db0100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8801c8db0180: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8801c8db0200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                    ^
 ffff8801c8db0280: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8801c8db0300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2017/10/24 08:24 net-next-old 058c8d591241 92f543f0 .config console log report ci-upstream-net-kasan-gce
2017/10/22 16:54 net-next-old f8ddadc4db6c ab829b1b .config console log report ci-upstream-net-kasan-gce
2017/10/21 20:37 net-next-old 3c467bf39910 4d9c0713 .config console log report ci-upstream-net-kasan-gce
2017/10/20 21:14 net-next-old d18b4b35e310 4d9c0713 .config console log report ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.