syzbot


KASAN: use-after-free Read in tipc_mcast_xmit

Status: fixed on 2019/01/11 01:22
Reported-by: syzbot+99f20222fc5018d2b97a@syzkaller.appspotmail.com
Fix commit: 3c6306d44082 tipc: check group dests after tipc_wait_for_cond()
First crash: 1510d, last: 1502d
similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-54 KASAN: use-after-free Read in tipc_mcast_xmit C 23 836d 857d 0/2 upstream: reported C repro on 2020/09/29 18:19
upstream KASAN: use-after-free Read in tipc_mcast_xmit (2) C done 37 840d 854d 17/24 fixed on 2020/11/16 12:12
linux-4.19 KASAN: use-after-free Read in tipc_mcast_xmit C done 3 828d 851d 1/1 fixed on 2020/11/28 11:57

Sample crash report:
IPv6: ADDRCONF(NETDEV_UP): veth1: link is not ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth0: link becomes ready
8021q: adding VLAN 0 to HW filter on device team0
==================================================================
BUG: KASAN: use-after-free in tipc_mcast_xmit+0xb77/0xdb0 net/tipc/bcast.c:305
Read of size 1 at addr ffff8881d3f9b04e by task syz-executor0/6303

CPU: 0 PID: 6303 Comm: syz-executor0 Not tainted 4.20.0-rc6+ #235
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+0x244/0x39d lib/dump_stack.c:113
 print_address_description.cold.7+0x9/0x1ff mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.8+0x242/0x309 mm/kasan/report.c:412
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:430
 tipc_mcast_xmit+0xb77/0xdb0 net/tipc/bcast.c:305
 tipc_send_group_bcast+0xa5f/0xdf0 net/tipc/socket.c:1054
 __tipc_sendmsg+0xeec/0x1d40 net/tipc/socket.c:1310
 tipc_sendmsg+0x50/0x70 net/tipc/socket.c:1275
 sock_sendmsg_nosec net/socket.c:621 [inline]
 sock_sendmsg+0xd5/0x120 net/socket.c:631
 ___sys_sendmsg+0x51d/0x930 net/socket.c:2116
 __sys_sendmmsg+0x246/0x6d0 net/socket.c:2211
 __do_sys_sendmmsg net/socket.c:2240 [inline]
 __se_sys_sendmmsg net/socket.c:2237 [inline]
 __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2237
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457669
Code: fd b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 cb b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fec9d4c9c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 0000000000457669
RDX: 0000000000000142 RSI: 0000000020000000 RDI: 0000000000000004
RBP: 000000000072bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fec9d4ca6d4
R13: 00000000004c3e14 R14: 00000000004d6c38 R15: 00000000ffffffff

Allocated by task 6303:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
 kmem_cache_alloc_trace+0x152/0x750 mm/slab.c:3620
 kmalloc include/linux/slab.h:546 [inline]
 kzalloc include/linux/slab.h:741 [inline]
 tipc_group_create+0x152/0xa70 net/tipc/group.c:171
 tipc_sk_join net/tipc/socket.c:2836 [inline]
 tipc_setsockopt+0x2d1/0xd70 net/tipc/socket.c:2951
 __sys_setsockopt+0x1ba/0x3c0 net/socket.c:1902
 __do_sys_setsockopt net/socket.c:1913 [inline]
 __se_sys_setsockopt net/socket.c:1910 [inline]
 __x64_sys_setsockopt+0xbe/0x150 net/socket.c:1910
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 6304:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xcf/0x230 mm/slab.c:3817
 tipc_group_delete+0x2e4/0x3f0 net/tipc/group.c:227
 tipc_sk_leave+0x113/0x220 net/tipc/socket.c:2870
 tipc_setsockopt+0x97d/0xd70 net/tipc/socket.c:2954
 __sys_setsockopt+0x1ba/0x3c0 net/socket.c:1902
 __do_sys_setsockopt net/socket.c:1913 [inline]
 __se_sys_setsockopt net/socket.c:1910 [inline]
 __x64_sys_setsockopt+0xbe/0x150 net/socket.c:1910
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8881d3f9b000
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 78 bytes inside of
 192-byte region [ffff8881d3f9b000, ffff8881d3f9b0c0)
The buggy address belongs to the page:
page:ffffea00074fe6c0 count:1 mapcount:0 mapping:ffff8881da800040 index:0x0
flags: 0x2fffc0000000200(slab)
raw: 02fffc0000000200 ffffea00074fe108 ffffea00074ecd88 ffff8881da800040
raw: 0000000000000000 ffff8881d3f9b000 0000000100000010 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881d3f9af00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8881d3f9af80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881d3f9b000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                              ^
 ffff8881d3f9b080: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8881d3f9b100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (7):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-net-this-kasan-gce 2018/12/17 17:54 net 369a094d500f def91db3 .config console log report syz
ci-upstream-net-this-kasan-gce 2018/12/16 15:31 net 8203e2d844d3 def91db3 .config console log report syz
ci-upstream-linux-next-kasan-gce-root 2018/12/24 04:41 linux-next 6648e120dd1a e3bd7ab8 .config console log report syz
ci-upstream-linux-next-kasan-gce-root 2018/12/23 18:20 linux-next 6648e120dd1a e3bd7ab8 .config console log report syz
ci-upstream-net-this-kasan-gce 2018/12/17 22:25 net 369a094d500f def91db3 .config console log report
ci-upstream-net-this-kasan-gce 2018/12/17 16:51 net 369a094d500f def91db3 .config console log report
ci-upstream-net-this-kasan-gce 2018/12/16 14:30 net 8203e2d844d3 def91db3 .config console log report
* Struck through repros no longer work on HEAD.