syzbot


KASAN: use-after-free Write in copyin

Status: auto-closed as invalid on 2020/08/09 16:10
Reported-by: syzbot+ec739c49637bbf1de038@syzkaller.appspotmail.com
First crash: 1518d, last: 1474d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in copyin+0x80/0xb0 lib/iov_iter.c:150
Write of size 110 at addr ffff8881c88a8140 by task syz-executor.4/16042

CPU: 1 PID: 16042 Comm: syz-executor.4 Tainted: G        W         5.4.31-syzkaller-00073-gfa41ab5369c7 #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+0x14a/0x1ce lib/dump_stack.c:118
 print_address_description+0x93/0x620 mm/kasan/report.c:374
 __kasan_report+0x16d/0x1e0 mm/kasan/report.c:506
 kasan_report+0x34/0x60 mm/kasan/common.c:634
 check_memory_region_inline mm/kasan/generic.c:182 [inline]
 check_memory_region+0x2b5/0x2f0 mm/kasan/generic.c:192
 copyin+0x80/0xb0 lib/iov_iter.c:150
 copy_page_from_iter_iovec lib/iov_iter.c:295 [inline]
 copy_page_from_iter+0x37f/0x660 lib/iov_iter.c:921
 tun_build_skb+0x1d4/0xbb0 drivers/net/tun.c:1681
 tun_get_user+0x62d/0x3320 drivers/net/tun.c:1818
 tun_chr_write_iter+0x121/0x1a0 drivers/net/tun.c:2026
 do_iter_readv_writev+0x651/0x8e0 include/linux/fs.h:1964
 do_iter_write+0x16d/0x570 fs/read_write.c:973
 vfs_writev fs/read_write.c:1018 [inline]
 do_writev+0x31c/0x5b0 fs/read_write.c:1061
 do_syscall_64+0xcb/0x150 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x45c741
Code: 75 14 b8 14 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 e4 b7 fb ff c3 48 83 ec 08 e8 fa 2c 00 00 48 89 04 24 b8 14 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 43 2d 00 00 48 89 d0 48 83 c4 08 48 3d 01
RSP: 002b:00007fd6100f9bc0 EFLAGS: 00000293 ORIG_RAX: 0000000000000014
RAX: ffffffffffffffda RBX: 000000000000006e RCX: 000000000045c741
RDX: 0000000000000001 RSI: 00007fd6100f9bf0 RDI: 00000000000000f0
RBP: 0000000020000100 R08: 0000000000000000 R09: 0000000000000000
R10: ffffffffffffffff R11: 0000000000000293 R12: 00000000ffffffff
R13: 0000000000000bb0 R14: 00000000004cdda9 R15: 000000000076bf0c

The buggy address belongs to the page:
page:ffffea0007222a00 refcount:0 mapcount:-128 mapping:0000000000000000 index:0x0
flags: 0x8000000000000000()
raw: 8000000000000000 ffffea00072fa608 ffffffff84d626f8 0000000000000000
raw: 0000000000000000 0000000000000003 00000000ffffff7f 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881c88a8000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8881c88a8080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff8881c88a8100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                           ^
 ffff8881c88a8180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8881c88a8200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================
BUG: Bad page state in process syz-executor.4  pfn:1c88a8
page:ffffea0007222a00 refcount:0 mapcount:0 mapping:ffff8881da8e2000 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881da8e2000
raw: 0000000000000000 0000000000070007 00000000ffffffff 0000000000000000
page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set
bad because of flags: 0x200(slab)
Modules linked in:
CPU: 0 PID: 16042 Comm: syz-executor.4 Tainted: G    B   W         5.4.31-syzkaller-00073-gfa41ab5369c7 #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+0x14a/0x1ce lib/dump_stack.c:118
 bad_page+0x2ab/0x2e0 mm/page_alloc.c:661
 free_pages_check_bad mm/page_alloc.c:1062 [inline]
 free_pages_check mm/page_alloc.c:1071 [inline]
 free_pages_prepare mm/page_alloc.c:1169 [inline]
 __free_pages_ok+0x73f/0xcd0 mm/page_alloc.c:1432
 put_page include/linux/mm.h:1050 [inline]
 tun_build_skb+0x9ee/0xbb0 drivers/net/tun.c:1734
 tun_get_user+0x62d/0x3320 drivers/net/tun.c:1818
 tun_chr_write_iter+0x121/0x1a0 drivers/net/tun.c:2026
 do_iter_readv_writev+0x651/0x8e0 include/linux/fs.h:1964
 do_iter_write+0x16d/0x570 fs/read_write.c:973
 vfs_writev fs/read_write.c:1018 [inline]
 do_writev+0x31c/0x5b0 fs/read_write.c:1061
 do_syscall_64+0xcb/0x150 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x45c741
Code: 75 14 b8 14 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 e4 b7 fb ff c3 48 83 ec 08 e8 fa 2c 00 00 48 89 04 24 b8 14 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 43 2d 00 00 48 89 d0 48 83 c4 08 48 3d 01
RSP: 002b:00007fd6100f9bc0 EFLAGS: 00000293 ORIG_RAX: 0000000000000014
RAX: ffffffffffffffda RBX: 000000000000006e RCX: 000000000045c741
RDX: 0000000000000001 RSI: 00007fd6100f9bf0 RDI: 00000000000000f0
RBP: 0000000020000100 R08: 0000000000000000 R09: 0000000000000000
R10: ffffffffffffffff R11: 0000000000000293 R12: 00000000ffffffff
R13: 0000000000000bb0 R14: 00000000004cdda9 R15: 000000000076bf0c

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/04/11 16:09 https://android.googlesource.com/kernel/common android-5.4 fa41ab5369c7 a8c6a3f8 .config console log report ci2-android-5-4-kasan
2020/03/30 01:56 https://android.googlesource.com/kernel/common android-5.4 8398205ce446 05736b29 .config console log report ci2-android-5-4-kasan
2020/03/08 18:56 https://android.googlesource.com/kernel/common android-5.4 3334f0da669e 2e9971bb .config console log report ci2-android-5-4-kasan
2020/02/28 00:21 https://android.googlesource.com/kernel/common android-5.4 35eb457cb886 c88c7b75 .config console log report ci2-android-5-4-kasan
* Struck through repros no longer work on HEAD.