syzbot


KASAN: stack-out-of-bounds Write in ax25_getname

Status: fixed on 2020/03/17 21:24
Reported-by: syzbot+9c7eba5cb11cdd213b8d@syzkaller.appspotmail.com
Fix commit: ad598a48fe61 vhost: Check docket sk_family instead of call getname
First crash: 1157d, last: 861d

Fix bisection: fixed by (bisect log) :
commit ad598a48fe61c6c2407f08a807cb7a2ea83386b3
Author: Eugenio PΓ©rez <eperezma@redhat.com>
Date: Fri Feb 21 11:06:56 2020 +0000

  vhost: Check docket sk_family instead of call getname

similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: stack-out-of-bounds Write in ax25_getname C done 4 861d 1157d 1/1 fixed on 2020/03/17 21:24
upstream KASAN: stack-out-of-bounds Write in ax25_getname C done error 21 859d 1274d 0/22 upstream: reported C repro on 2018/12/29 19:11

Sample crash report:
kauditd_printk_skb: 5 callbacks suppressed
audit: type=1400 audit(1581809293.273:36): avc:  denied  { map } for  pid=8186 comm="syz-executor852" path="/root/syz-executor852068025" dev="sda1" ino=16483 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
==================================================================
BUG: KASAN: stack-out-of-bounds in memset include/linux/string.h:333 [inline]
BUG: KASAN: stack-out-of-bounds in ax25_getname+0x58/0x7a0 net/ax25/af_ax25.c:1408
Write of size 72 at addr ffff88808f2e7c78 by task syz-executor852/8186

CPU: 0 PID: 8186 Comm: syz-executor852 Not tainted 4.19.104-syzkaller #0
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+0x197/0x210 lib/dump_stack.c:118
 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report mm/kasan/report.c:412 [inline]
 kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396
 check_memory_region_inline mm/kasan/kasan.c:260 [inline]
 check_memory_region+0x123/0x190 mm/kasan/kasan.c:267
 memset+0x24/0x40 mm/kasan/kasan.c:285
 memset include/linux/string.h:333 [inline]
 ax25_getname+0x58/0x7a0 net/ax25/af_ax25.c:1408
 get_raw_socket drivers/vhost/net.c:1206 [inline]
 get_socket drivers/vhost/net.c:1262 [inline]
 vhost_net_set_backend drivers/vhost/net.c:1297 [inline]
 vhost_net_ioctl+0x120a/0x1900 drivers/vhost/net.c:1488
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0xd5f/0x1380 fs/ioctl.c:688
 ksys_ioctl+0xab/0xd0 fs/ioctl.c:705
 __do_sys_ioctl fs/ioctl.c:712 [inline]
 __se_sys_ioctl fs/ioctl.c:710 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:710
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x440259
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 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 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fff83b7c0a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 0000000000440259
RDX: 0000000020f1dff8 RSI: 000000004008af30 RDI: 0000000000000003
RBP: 00000000006ca018 R08: 00000000004002c8 R09: 00000000004002c8
R10: 00000000004002c8 R11: 0000000000000246 R12: 0000000000401ae0
R13: 0000000000401b70 R14: 0000000000000000 R15: 0000000000000000

The buggy address belongs to the page:
page:ffffea00023cb9c0 count:0 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0xfffe0000000000()
raw: 00fffe0000000000 0000000000000000 ffffffff023c0101 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88808f2e7b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f1
 ffff88808f2e7c00: f1 f1 f1 f1 f1 04 f2 00 f2 f2 f2 00 f2 f2 f2 00
>ffff88808f2e7c80: 00 00 00 00 00 04 f3 f3 f3 f3 f3 00 00 00 00 00
                                  ^
 ffff88808f2e7d00: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
 ffff88808f2e7d80: 00 f2 f2 f2 00 00 00 f2 f2 f2 f2 f2 00 00 00 00
==================================================================

Crashes (4):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-19 2020/02/15 23:31 linux-4.19.y 9b15f7fae677 5d7b90f1 .config log report syz C
ci2-linux-4-19 2019/11/14 20:37 linux-4.19.y c555efaf1402 048f2d49 .config log report syz
ci2-linux-4-19 2019/04/26 08:48 linux-4.19.y c98875d930e9 b617407b .config log report syz
ci2-linux-4-19 2019/11/14 20:06 linux-4.19.y c555efaf1402 048f2d49 .config log report