syzbot


KASAN: slab-out-of-bounds Read in copy_page_from_iter_atomic

Status: upstream: reported C repro on 2023/04/16 06:15
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+ae02bc0f2673abd0edaa@syzkaller.appspotmail.com
First crash: 587d, last: 33d
Bug presence (1)
Date Name Commit Repro Result
2023/11/11 upstream (ToT) 18553507f60f C [report] KASAN: slab-out-of-bounds Read in generic_perform_write
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in copy_page_from_iter_atomic (2) btrfs C done error 67 457d 900d 0/28 auto-obsoleted due to no activity on 2024/03/22 14:46
linux-5.15 KASAN: slab-out-of-bounds Read in copy_page_from_iter_atomic origin:upstream C error 11 411d 613d 0/3 upstream: reported C repro on 2023/03/20 18:09
upstream KASAN: use-after-free Read in copy_page_from_iter_atomic jfs 8 1049d 1163d 0/28 auto-closed as invalid on 2022/05/09 13:28
Fix bisection attempts (12)
Created Duration User Patch Repo Result
2024/10/20 16:29 2h12m bisect fix linux-6.1.y OK (0) job log log
2024/09/19 05:58 1h26m bisect fix linux-6.1.y OK (0) job log log
2024/08/15 17:49 2h23m bisect fix linux-6.1.y OK (0) job log log
2024/07/06 07:14 1h06m bisect fix linux-6.1.y OK (0) job log log
2024/05/27 14:23 1h21m bisect fix linux-6.1.y OK (0) job log log
2024/04/22 05:54 1h37m bisect fix linux-6.1.y OK (0) job log log
2024/03/21 07:36 1h16m bisect fix linux-6.1.y OK (0) job log log
2024/02/20 03:29 1h06m bisect fix linux-6.1.y OK (0) job log log
2024/01/10 03:11 1h23m bisect fix linux-6.1.y OK (0) job log log
2023/12/11 00:01 1h32m bisect fix linux-6.1.y OK (0) job log log
2023/11/10 21:52 1h59m bisect fix linux-6.1.y OK (0) job log log
2023/10/08 12:27 1h49m bisect fix linux-6.1.y OK (0) job log log

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in copy_page_from_iter_atomic+0x872/0x1100 lib/iov_iter.c:820
Read of size 2048 at addr ffff888020c01800 by task kworker/u4:0/9

CPU: 0 PID: 9 Comm: kworker/u4:0 Not tainted 6.1.31-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
Workqueue: loop0 loop_rootcg_workfn
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:395
 kasan_report+0x136/0x160 mm/kasan/report.c:495
 kasan_check_range+0x27f/0x290 mm/kasan/generic.c:189
 memcpy+0x25/0x60 mm/kasan/shadow.c:65
 copy_page_from_iter_atomic+0x872/0x1100 lib/iov_iter.c:820
 generic_perform_write+0x36c/0x5e0 mm/filemap.c:3762
 __generic_file_write_iter+0x176/0x400 mm/filemap.c:3882
 generic_file_write_iter+0xab/0x310 mm/filemap.c:3914
 do_iter_write+0x6e6/0xc50 fs/read_write.c:861
 lo_write_bvec drivers/block/loop.c:249 [inline]
 lo_write_simple drivers/block/loop.c:271 [inline]
 do_req_filebacked drivers/block/loop.c:495 [inline]
 loop_handle_cmd drivers/block/loop.c:1882 [inline]
 loop_process_work+0x13ff/0x2200 drivers/block/loop.c:1917
 process_one_work+0x8aa/0x11f0 kernel/workqueue.c:2289
 worker_thread+0xa5f/0x1210 kernel/workqueue.c:2436
 kthread+0x26e/0x300 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
 </TASK>

Allocated by task 3538:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slab_common.c:955 [inline]
 __kmalloc+0xb2/0x230 mm/slab_common.c:968
 kmalloc include/linux/slab.h:558 [inline]
 hfsplus_read_wrapper+0x52c/0x1330 fs/hfsplus/wrapper.c:178
 hfsplus_fill_super+0x38a/0x1c90 fs/hfsplus/super.c:413
 mount_bdev+0x2c9/0x3f0 fs/super.c:1423
 legacy_get_tree+0xeb/0x180 fs/fs_context.c:610
 vfs_get_tree+0x88/0x270 fs/super.c:1553
 do_new_mount+0x28b/0xae0 fs/namespace.c:3040
 do_mount fs/namespace.c:3383 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff888020c01800
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 0 bytes inside of
 512-byte region [ffff888020c01800, ffff888020c01a00)

The buggy address belongs to the physical page:
page:ffffea0000830000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x20c00
head:ffffea0000830000 order:2 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea000089d900 dead000000000002 ffff888012441c80
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, tgid 1 (swapper/0), ts 6504986201, free_ts 0
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2533
 prep_new_page mm/page_alloc.c:2540 [inline]
 get_page_from_freelist+0x32ed/0x3480 mm/page_alloc.c:4292
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5559
 alloc_page_interleave+0x22/0x1c0 mm/mempolicy.c:2113
 alloc_slab_page+0x6a/0x150 mm/slub.c:1794
 allocate_slab mm/slub.c:1939 [inline]
 new_slab+0x84/0x2d0 mm/slub.c:1992
 ___slab_alloc+0xa71/0x1080 mm/slub.c:3180
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 __kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:954 [inline]
 __kmalloc+0xa1/0x230 mm/slab_common.c:968
 kmalloc include/linux/slab.h:558 [inline]
 kzalloc include/linux/slab.h:689 [inline]
 alloc_workqueue+0x18e/0x1440 kernel/workqueue.c:4316
 nvmet_init+0x4b/0x13e drivers/nvme/target/core.c:1647
 do_one_initcall+0x265/0x8f0 init/main.c:1303
 do_initcall_level+0x157/0x207 init/main.c:1376
 do_initcalls+0x49/0x86 init/main.c:1392
 kernel_init_freeable+0x473/0x61f init/main.c:1631
 kernel_init+0x19/0x290 init/main.c:1519
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888020c01900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888020c01980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888020c01a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                   ^
 ffff888020c01a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888020c01b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/03 15:15 linux-6.1.y d2869ace6eeb a4ae4f42 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Read in copy_page_from_iter_atomic
2023/05/02 09:15 linux-6.1.y ca48fc16c493 62df2017 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan-arm64 KASAN: slab-out-of-bounds Read in copy_page_from_iter_atomic
2023/07/10 13:48 linux-6.1.y 61fd484b2cf6 d47e94ee .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: slab-out-of-bounds Read in copy_page_from_iter_atomic
2023/04/16 06:15 linux-6.1.y 0102425ac76b ec410564 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: slab-out-of-bounds Read in copy_page_from_iter_atomic
2023/08/17 09:48 linux-6.1.y 6c44e13dc284 74b106b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in copy_page_from_iter_atomic
2023/06/16 08:44 linux-6.1.y ca87e77a2ef8 f3921d4d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in copy_page_from_iter_atomic
2023/05/08 19:42 linux-6.1.y ca48fc16c493 c7a5e2a0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in copy_page_from_iter_atomic
* Struck through repros no longer work on HEAD.