syzbot


KASAN: use-after-free Read in tipc_group_self

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

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in tipc_group_self+0x1a2/0x1b0 net/tipc/group.c:335
Read of size 4 at addr ffff8801d8ab9d6c by task syzkaller125265/2986

CPU: 1 PID: 2986 Comm: syzkaller125265 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_load4_noabort+0x14/0x20 mm/kasan/report.c:429
 tipc_group_self+0x1a2/0x1b0 net/tipc/group.c:335
 tipc_sk_leave+0xfc/0x200 net/tipc/socket.c:2777
 tipc_release+0x154/0xfe0 net/tipc/socket.c:575
 sock_release+0x8d/0x1e0 net/socket.c:597
 sock_close+0x16/0x20 net/socket.c:1126
 __fput+0x327/0x7e0 fs/file_table.c:210
 ____fput+0x15/0x20 fs/file_table.c:244
 task_work_run+0x199/0x270 kernel/task_work.c:112
 exit_task_work include/linux/task_work.h:21 [inline]
 do_exit+0x9b5/0x1ad0 kernel/exit.c:865
 do_group_exit+0x149/0x400 kernel/exit.c:968
 SYSC_exit_group kernel/exit.c:979 [inline]
 SyS_exit_group+0x1d/0x20 kernel/exit.c:977
 entry_SYSCALL_64_fastpath+0x1f/0xbe
RIP: 0033:0x43e978
RSP: 002b:00007ffeaf4d3468 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000043e978
RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
RBP: 00000000000014b1 R08: 00000000000000e7 R09: ffffffffffffffd0
R10: 0000000020000fe4 R11: 0000000000000246 R12: 00000000006ca858
R13: 00000000006ca858 R14: 0000000000000000 R15: 0000000000002710

Allocated by task 2986:
 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 2986:
 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 ffff8801d8ab9d00
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 108 bytes inside of
 192-byte region [ffff8801d8ab9d00, ffff8801d8ab9dc0)
The buggy address belongs to the page:
page:ffffea000762ae40 count:1 mapcount:0 mapping:ffff8801d8ab9000 index:0xffff8801d8ab9f00
flags: 0x200000000000100(slab)
raw: 0200000000000100 ffff8801d8ab9000 ffff8801d8ab9f00 000000010000000d
raw: ffff8801dac01138 ffffea0007610ce0 ffff8801dac00040 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801d8ab9c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801d8ab9c80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8801d8ab9d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                          ^
 ffff8801d8ab9d80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8801d8ab9e00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (2942):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2017/10/24 08:43 net-next-old 058c8d591241 92f543f0 .config console log report syz C ci-upstream-net-kasan-gce
2017/10/22 17:09 net-next-old f8ddadc4db6c ab829b1b .config console log report syz C ci-upstream-net-kasan-gce
2017/10/21 20:59 net-next-old 3c467bf39910 4d9c0713 .config console log report syz C ci-upstream-net-kasan-gce
2017/10/20 21:30 net-next-old d18b4b35e310 4d9c0713 .config console log report syz C ci-upstream-net-kasan-gce
2017/10/20 12:03 net-next-old d18b4b35e310 4d9c0713 .config console log report syz C ci-upstream-net-kasan-gce
2017/10/20 11:31 net-next-old d18b4b35e310 4d9c0713 .config console log report syz C ci-upstream-net-kasan-gce
2017/10/29 06:08 linux-next 36ef71cae353 e511d9f8 .config console log report syz C ci-upstream-next-kasan-gce
2017/10/29 02:21 linux-next 36ef71cae353 e511d9f8 .config console log report syz C ci-upstream-next-kasan-gce
2017/10/28 22:34 linux-next 36ef71cae353 e511d9f8 .config console log report syz C ci-upstream-next-kasan-gce
2017/10/28 17:03 linux-next 36ef71cae353 e511d9f8 .config console log report syz C ci-upstream-next-kasan-gce
2017/10/28 15:55 linux-next 36ef71cae353 e511d9f8 .config console log report syz C ci-upstream-next-kasan-gce
2017/10/28 15:38 linux-next 36ef71cae353 e511d9f8 .config console log report syz C ci-upstream-next-kasan-gce
2017/10/24 08:54 linux-next 36ef71cae353 e511d9f8 .config console log report syz C skylake-linux-next-kasan-qemu
2017/10/24 08:54 mmots 0f611fb6dcc0 e0a2b195 .config console log report syz C ci-upstream-mmots-kasan-gce
2017/10/22 17:32 mmots 0f611fb6dcc0 e0a2b195 .config console log report syz C ci-upstream-mmots-kasan-gce
2017/10/22 17:20 linux-next 36ef71cae353 e511d9f8 .config console log report syz C ci-upstream-next-kasan-gce
2017/10/21 21:59 mmots 0f611fb6dcc0 e0a2b195 .config console log report syz C ci-upstream-mmots-kasan-gce
2017/10/21 21:20 linux-next 36ef71cae353 e511d9f8 .config console log report syz C ci-upstream-next-kasan-gce
2017/10/20 21:41 linux-next 36ef71cae353 e511d9f8 .config console log report syz C ci-upstream-next-kasan-gce
2017/10/20 21:40 mmots 65302eba00ae 4d9c0713 .config console log report syz C ci-upstream-mmots-kasan-gce
2017/10/20 12:28 mmots 65302eba00ae 4d9c0713 .config console log report syz C ci-upstream-mmots-kasan-gce
2017/10/20 12:20 linux-next 36ef71cae353 e511d9f8 .config console log report syz C ci-upstream-next-kasan-gce
2017/10/20 11:54 mmots 65302eba00ae 4d9c0713 .config console log report syz C ci-upstream-mmots-kasan-gce
2017/10/20 11:53 linux-next 36ef71cae353 e511d9f8 .config console log report syz C ci-upstream-next-kasan-gce
2017/10/26 07:06 net-next-old f65163fed0e7 83d9c302 .config console log report ci-upstream-net-kasan-gce
2017/10/26 03:22 net-next-old f65163fed0e7 83d9c302 .config console log report ci-upstream-net-kasan-gce
2017/10/25 16:16 net-next-old 56546e3b9f22 83d9c302 .config console log report ci-upstream-net-kasan-gce
2017/10/25 11:34 net-next-old 56546e3b9f22 83d9c302 .config console log report ci-upstream-net-kasan-gce
2017/10/25 08:24 net-next-old 6a331e1513af 3d7d860f .config console log report ci-upstream-net-kasan-gce
2017/10/25 07:44 net-next-old 6a331e1513af 3d7d860f .config console log report ci-upstream-net-kasan-gce
2017/10/25 05:54 net-next-old 6a331e1513af 3d7d860f .config console log report ci-upstream-net-kasan-gce
2017/10/24 17:39 net-next-old 49ca1943a7ad 92f543f0 .config console log report ci-upstream-net-kasan-gce
2017/10/24 14:04 net-next-old 49ca1943a7ad 92f543f0 .config console log report ci-upstream-net-kasan-gce
2017/10/24 07:43 net-next-old 058c8d591241 92f543f0 .config console log report ci-upstream-net-kasan-gce
2017/10/24 01:52 net-next-old 058c8d591241 92f543f0 .config console log report ci-upstream-net-kasan-gce
2017/10/23 09:08 net-next-old 33ad61d0f799 632b86c9 .config console log report ci-upstream-net-kasan-gce
2017/10/22 23:12 net-next-old f8ddadc4db6c ab829b1b .config console log report ci-upstream-net-kasan-gce
2017/10/21 05:50 net-next-old 7f9ad2ace17a 4d9c0713 .config console log report ci-upstream-net-kasan-gce
2017/10/21 02:28 net-next-old 7f9ad2ace17a 4d9c0713 .config console log report ci-upstream-net-kasan-gce
2017/10/20 18:03 net-next-old d18b4b35e310 4d9c0713 .config console log report ci-upstream-net-kasan-gce
2017/10/20 16:01 net-next-old d18b4b35e310 4d9c0713 .config console log report ci-upstream-net-kasan-gce
2017/11/07 02:57 mmots 0f611fb6dcc0 e0a2b195 .config console log report ci-upstream-mmots-kasan-gce
2017/11/01 07:44 linux-next 36ef71cae353 e511d9f8 .config console log report ci-upstream-next-kasan-gce
2017/10/27 18:04 linux-next 36ef71cae353 e511d9f8 .config console log report ci-upstream-next-kasan-gce
* Struck through repros no longer work on HEAD.