syzbot


KASAN: use-after-free Write in _copy_from_iter

Status: auto-obsoleted due to no activity on 2023/05/19 17:02
Subsystems: net
[Documentation on labels]
First crash: 453d, last: 453d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in _copy_from_iter (2) tipc 2 884d 932d 0/26 auto-closed as invalid on 2022/03/05 23:58

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in instrument_copy_from_user_before include/linux/instrumented.h:137 [inline]
BUG: KASAN: use-after-free in copyin lib/iov_iter.c:182 [inline]
BUG: KASAN: use-after-free in _copy_from_iter+0x2b8/0x1010 lib/iov_iter.c:634
Write of size 16420 at addr ffff8880226f82dc by task sshd/5050

CPU: 0 PID: 5050 Comm: sshd Not tainted 6.2.0-rc7-syzkaller-00135-g38c1e0c65865 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:306 [inline]
 print_report+0x163/0x4f0 mm/kasan/report.c:417
 kasan_report+0x13a/0x170 mm/kasan/report.c:517
 kasan_check_range+0x283/0x290 mm/kasan/generic.c:189
 instrument_copy_from_user_before include/linux/instrumented.h:137 [inline]
 copyin lib/iov_iter.c:182 [inline]
 _copy_from_iter+0x2b8/0x1010 lib/iov_iter.c:634
 copy_from_iter include/linux/uio.h:187 [inline]
 copy_from_iter_full include/linux/uio.h:194 [inline]
 skb_do_copy_data_nocache include/net/sock.h:2268 [inline]
 skb_copy_to_page_nocache include/net/sock.h:2294 [inline]
 tcp_sendmsg_locked+0x173c/0x4100 net/ipv4/tcp.c:1377
 tcp_sendmsg+0x30/0x50 net/ipv4/tcp.c:1484
 sock_sendmsg_nosec net/socket.c:714 [inline]
 sock_sendmsg net/socket.c:734 [inline]
 sock_write_iter+0x398/0x4e0 net/socket.c:1108
 call_write_iter include/linux/fs.h:2189 [inline]
 new_sync_write fs/read_write.c:491 [inline]
 vfs_write+0x7b2/0xbb0 fs/read_write.c:584
 ksys_write+0x1a0/0x2c0 fs/read_write.c:637
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f34d18aa9a3
Code: 8b 15 d9 f4 0c 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 64 8b 04 25 18 00 00 00 85 c0 75 14 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 55 c3 0f 1f 40 00 48 83 ec 28 48 89 54 24 18
RSP: 002b:00007fffb2d32368 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000004024 RCX: 00007f34d18aa9a3
RDX: 0000000000004024 RSI: 00007f34d1727010 RDI: 0000000000000004
RBP: 000055ac2ceefde0 R08: 0000000000000000 R09: 0000000000000070
R10: 00007fffb2d8f080 R11: 0000000000000246 R12: 0000000000000004
R13: 0000000000000001 R14: 00007fffb2d323d8 R15: 00007fffb2d32458
 </TASK>

The buggy address belongs to the physical page:
page:ffffea000089be00 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x226f8
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea0001e0fe08 ffff8880b9841ea0 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1528c0(GFP_NOWAIT|__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 5050, tgid 5050 (sshd), ts 1004561796440, free_ts 1004610315196
 prep_new_page mm/page_alloc.c:2531 [inline]
 get_page_from_freelist+0x3449/0x35c0 mm/page_alloc.c:4283
 __alloc_pages+0x291/0x7e0 mm/page_alloc.c:5549
 skb_page_frag_refill+0x158/0x2f0 net/core/sock.c:2867
 sk_page_frag_refill+0x4c/0xe0 net/core/sock.c:2887
 tcp_sendmsg_locked+0x112d/0x4100 net/ipv4/tcp.c:1353
 tcp_sendmsg+0x30/0x50 net/ipv4/tcp.c:1484
 sock_sendmsg_nosec net/socket.c:714 [inline]
 sock_sendmsg net/socket.c:734 [inline]
 sock_write_iter+0x398/0x4e0 net/socket.c:1108
 call_write_iter include/linux/fs.h:2189 [inline]
 new_sync_write fs/read_write.c:491 [inline]
 vfs_write+0x7b2/0xbb0 fs/read_write.c:584
 ksys_write+0x1a0/0x2c0 fs/read_write.c:637
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
page last free stack trace:
 create_dummy_stack mm/page_owner.c:67 [inline]
 register_dummy_stack+0x8a/0xe0 mm/page_owner.c:73
 init_page_owner+0x34/0x9d0 mm/page_owner.c:91
 kernel_init_freeable+0x46b/0x630 init/main.c:1632
 kernel_init+0x1d/0x2a0 init/main.c:1522

Memory state around the buggy address:
 ffff8880226f8180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8880226f8200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff8880226f8280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                                    ^
 ffff8880226f8300: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8880226f8380: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/02/10 15:48 upstream 38c1e0c65865 e29a17f5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Write in _copy_from_iter
* Struck through repros no longer work on HEAD.