syzbot


KASAN: use-after-free Read in copy_page_from_iter_atomic
Status: auto-closed as invalid on 2022/05/09 13:28
Reported-by: syzbot+ffc4eceb22dfcf9fd6a0@syzkaller.appspotmail.com
First crash: 270d, last: 139d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in memcpy include/linux/fortify-string.h:225 [inline]
BUG: KASAN: use-after-free in copy_page_from_iter_atomic+0xd00/0x16c0 lib/iov_iter.c:969
Read of size 4096 at addr ffff8880221f4000 by task kworker/u4:8/8317

CPU: 0 PID: 8317 Comm: kworker/u4:8 Not tainted 5.16.0-rc8-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: loop3 loop_workfn
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_address_description.constprop.0.cold+0x8d/0x320 mm/kasan/report.c:247
 __kasan_report mm/kasan/report.c:433 [inline]
 kasan_report.cold+0x83/0xdf mm/kasan/report.c:450
 check_region_inline mm/kasan/generic.c:183 [inline]
 kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189
 memcpy+0x20/0x60 mm/kasan/shadow.c:65
 memcpy include/linux/fortify-string.h:225 [inline]
 copy_page_from_iter_atomic+0xd00/0x16c0 lib/iov_iter.c:969
 generic_perform_write+0x27a/0x510 mm/filemap.c:3762
 __generic_file_write_iter+0x1c7/0x510 mm/filemap.c:3881
 generic_file_write_iter+0xd7/0x220 mm/filemap.c:3913
 call_write_iter include/linux/fs.h:2162 [inline]
 do_iter_readv_writev+0x472/0x750 fs/read_write.c:725
 do_iter_write+0x188/0x710 fs/read_write.c:851
 vfs_iter_write+0x70/0xa0 fs/read_write.c:892
 lo_write_bvec drivers/block/loop.c:243 [inline]
 lo_write_simple drivers/block/loop.c:265 [inline]
 do_req_filebacked drivers/block/loop.c:494 [inline]
 loop_handle_cmd drivers/block/loop.c:1857 [inline]
 loop_process_work+0x128c/0x1db0 drivers/block/loop.c:1897
 process_one_work+0x9b2/0x1660 kernel/workqueue.c:2298
 worker_thread+0x65d/0x1130 kernel/workqueue.c:2445
 kthread+0x405/0x4f0 kernel/kthread.c:327
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
 </TASK>

The buggy address belongs to the page:
page:ffffea0000887d00 refcount:1 mapcount:-512 mapping:0000000000000000 index:0x0 pfn:0x221f4
memcg:ffff888074ab9d02
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 ffff888025a1d4e0 00000001fffffdff ffff888074ab9d02
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x500dc0(GFP_USER|__GFP_ZERO|__GFP_ACCOUNT), pid 7759, ts 1366708834139, free_ts 1366691682851
 prep_new_page mm/page_alloc.c:2418 [inline]
 get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4149
 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369
 alloc_pages+0x1a7/0x300 mm/mempolicy.c:2190
 __pte_alloc_one include/asm-generic/pgalloc.h:63 [inline]
 pte_alloc_one+0x16/0x230 arch/x86/mm/pgtable.c:33
 __pte_alloc+0x69/0x250 mm/memory.c:464
 copy_pte_range mm/memory.c:1024 [inline]
 copy_pmd_range mm/memory.c:1159 [inline]
 copy_pud_range mm/memory.c:1196 [inline]
 copy_p4d_range mm/memory.c:1220 [inline]
 copy_page_range+0x186e/0x42c0 mm/memory.c:1293
 dup_mmap kernel/fork.c:609 [inline]
 dup_mm+0xa4e/0x13e0 kernel/fork.c:1450
 copy_mm kernel/fork.c:1502 [inline]
 copy_process+0x6fed/0x75a0 kernel/fork.c:2191
 kernel_clone+0xe7/0xab0 kernel/fork.c:2582
 __do_sys_clone+0xc8/0x110 kernel/fork.c:2699
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1338 [inline]
 free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1389
 free_unref_page_prepare mm/page_alloc.c:3309 [inline]
 free_unref_page+0x19/0x690 mm/page_alloc.c:3388
 lbmLogShutdown fs/jfs/jfs_logmgr.c:1872 [inline]
 lmLogShutdown+0x33d/0x600 fs/jfs/jfs_logmgr.c:1692
 lmLogClose+0x55f/0x700 fs/jfs/jfs_logmgr.c:1468
 jfs_umount+0x2d3/0x3f0 fs/jfs/jfs_umount.c:116
 jfs_fill_super+0xa47/0xc70 fs/jfs/super.c:604
 mount_bdev+0x34d/0x410 fs/super.c:1370
 legacy_get_tree+0x105/0x220 fs/fs_context.c:610
 vfs_get_tree+0x89/0x2f0 fs/super.c:1500
 do_new_mount fs/namespace.c:2988 [inline]
 path_mount+0x1320/0x1fa0 fs/namespace.c:3318
 do_mount fs/namespace.c:3331 [inline]
 __do_sys_mount fs/namespace.c:3539 [inline]
 __se_sys_mount fs/namespace.c:3516 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3516
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Memory state around the buggy address:
 ffff8880221f3f00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8880221f3f80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8880221f4000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                   ^
 ffff8880221f4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880221f4100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (8):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-root 2022/01/09 13:27 upstream 4634129ad9fd 2ca0d385 .config log report info KASAN: use-after-free Read in copy_page_from_iter_atomic
ci-upstream-kasan-gce-root 2021/12/17 11:03 upstream fa36bbe6d43f 44068e19 .config log report info KASAN: use-after-free Read in copy_page_from_iter_atomic
ci-upstream-kasan-gce-selinux-root 2021/10/26 14:54 upstream 3906fe9bb7f1 d50eb50a .config log report info KASAN: use-after-free Read in copy_page_from_iter_atomic
ci-upstream-kasan-gce-smack-root 2021/10/20 04:25 upstream d9abdee5fd5a 466b7db1 .config log report info KASAN: use-after-free Read in copy_page_from_iter_atomic
ci-upstream-kasan-gce-root 2021/10/17 21:25 upstream d999ade1cc86 0c5d9412 .config log report info KASAN: use-after-free Read in copy_page_from_iter_atomic
ci-upstream-kasan-gce-smack-root 2021/08/31 05:28 upstream 7d2a07b76933 8f58a0ef .config log report info KASAN: use-after-free Read in copy_page_from_iter_atomic
ci-upstream-linux-next-kasan-gce-root 2021/11/22 16:37 linux-next 5191249f8803 545ab074 .config log report info KASAN: use-after-free Read in copy_page_from_iter_atomic
ci-upstream-linux-next-kasan-gce-root 2021/11/03 21:34 linux-next 8ccbda2840b7 4c1be0be .config log report info KASAN: use-after-free Read in copy_page_from_iter_atomic