syzbot


KASAN: use-after-free Read in tipc_sub_unsubscribe

Status: closed as invalid on 2018/04/10 15:19
Subsystems: tipc
[Documentation on labels]
Reported-by: syzbot+6c044019a7d406e78f16@syzkaller.appspotmail.com
First crash: 2229d, last: 2228d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in tipc_sub_unsubscribe (2) tipc C 5 2209d 2216d 5/26 fixed on 2018/05/08 18:30

Sample crash report:
R10: 0000000020265000 R11: 0000000000000246 R12: 0000000000000014
R13: 00000000000005ee R14: 00000000006faef0 R15: 0000000000000003
Name sequence creation failed, no memory
Failed to create subscription for {1020,0,4294967295}
==================================================================
BUG: KASAN: use-after-free in tipc_sub_unsubscribe+0x203/0x2e0 net/tipc/subscr.c:165
Read of size 4 at addr ffff8801c8685398 by task syz-executor7/23648

CPU: 0 PID: 23648 Comm: syz-executor7 Not tainted 4.16.0-rc6+ #288
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+0x194/0x24d lib/dump_stack.c:53
 print_address_description+0x73/0x250 mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report+0x23c/0x360 mm/kasan/report.c:412
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:432
 tipc_sub_unsubscribe+0x203/0x2e0 net/tipc/subscr.c:165
 tipc_conn_delete_sub+0x324/0x4a0 net/tipc/topsrv.c:245
 tipc_topsrv_kern_unsubscr+0x21d/0x350 net/tipc/topsrv.c:598
 tipc_group_delete+0x2c0/0x3d0 net/tipc/group.c:231
 tipc_sk_leave+0x10b/0x200 net/tipc/socket.c:2800
 tipc_release+0x154/0xff0 net/tipc/socket.c:576
 sock_release+0x8d/0x1e0 net/socket.c:594
 sock_close+0x16/0x20 net/socket.c:1149
 __fput+0x327/0x7e0 fs/file_table.c:209
 ____fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x199/0x270 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x275/0x2f0 arch/x86/entry/common.c:166
 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:265 [inline]
 do_syscall_64+0x6ec/0x940 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x454e79
RSP: 002b:00007f12309fcc68 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 00007f12309fd6d4 RCX: 0000000000454e79
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000013
RBP: 000000000072bea0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 0000000000000052 R14: 00000000006f2850 R15: 0000000000000000

Allocated by task 23648:
 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:552
 kmem_cache_alloc_trace+0x136/0x740 mm/slab.c:3607
 kmalloc include/linux/slab.h:512 [inline]
 tipc_sub_subscribe+0x200/0x510 net/tipc/subscr.c:143
 tipc_conn_rcv_sub.isra.5+0x383/0x760 net/tipc/topsrv.c:381
 tipc_topsrv_kern_subscr+0x5fb/0x9d0 net/tipc/topsrv.c:582
 tipc_group_create+0x6f2/0x990 net/tipc/group.c:194
 tipc_sk_join net/tipc/socket.c:2766 [inline]
 tipc_setsockopt+0x28a/0xcf0 net/tipc/socket.c:2881
 SYSC_setsockopt net/socket.c:1850 [inline]
 SyS_setsockopt+0x189/0x360 net/socket.c:1829
 do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 23648:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:520
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:527
 __cache_free mm/slab.c:3485 [inline]
 kfree+0xd9/0x260 mm/slab.c:3800
 tipc_sub_kref_release net/tipc/subscr.c:117 [inline]
 kref_put include/linux/kref.h:70 [inline]
 tipc_sub_put+0x26/0x30 net/tipc/subscr.c:122
 tipc_nametbl_unsubscribe+0x473/0x990 net/tipc/name_table.c:809
 tipc_sub_unsubscribe+0x6d/0x2e0 net/tipc/subscr.c:164
 tipc_conn_delete_sub+0x324/0x4a0 net/tipc/topsrv.c:245
 tipc_topsrv_kern_unsubscr+0x21d/0x350 net/tipc/topsrv.c:598
 tipc_group_delete+0x2c0/0x3d0 net/tipc/group.c:231
 tipc_sk_leave+0x10b/0x200 net/tipc/socket.c:2800
 tipc_release+0x154/0xff0 net/tipc/socket.c:576
 sock_release+0x8d/0x1e0 net/socket.c:594
 sock_close+0x16/0x20 net/socket.c:1149
 __fput+0x327/0x7e0 fs/file_table.c:209
 ____fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x199/0x270 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x275/0x2f0 arch/x86/entry/common.c:166
 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:265 [inline]
 do_syscall_64+0x6ec/0x940 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8801c8685300
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 152 bytes inside of
 256-byte region [ffff8801c8685300, ffff8801c8685400)
The buggy address belongs to the page:
page:ffffea000721a140 count:1 mapcount:0 mapping:ffff8801c8685080 index:0xffff8801c8685080
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffff8801c8685080 ffff8801c8685080 000000010000000b
raw: ffffea00076335a0 ffffea000729cae0 ffff8801dac007c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801c8685280: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8801c8685300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801c8685380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff8801c8685400: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff8801c8685480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/03/31 10:01 net-next-old c0b6edef0bf0 8fbce0e4 .config console log report ci-upstream-net-kasan-gce
2018/03/30 06:44 net-next-old 18845557fd6f d47f0ed6 .config console log report ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.