syzbot


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

Status: upstream: reported C repro on 2023/03/20 18:09
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+73537d8cac715987374b@syzkaller.appspotmail.com
First crash: 400d, last: 198d
Fix bisection: failed (error log, bisect log)
  
Bug presence (1)
Date Name Commit Repro Result
2023/10/08 upstream (ToT) 94f6f0550c62 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 244d 686d 0/26 auto-obsoleted due to no activity on 2024/03/22 14:46
linux-6.1 KASAN: slab-out-of-bounds Read in copy_page_from_iter_atomic origin:upstream C 7 2d01h 374d 0/3 upstream: reported C repro on 2023/04/16 06:15
upstream KASAN: use-after-free Read in copy_page_from_iter_atomic jfs 8 835d 949d 0/26 auto-closed as invalid on 2022/05/09 13:28
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2023/11/10 17:50 0m bisect fix linux-5.15.y error job log (0)
2023/10/08 21:34 1h16m bisect fix linux-5.15.y job log (0) log

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in copy_page_from_iter_atomic+0x8e3/0x1230 lib/iov_iter.c:978
Read of size 1024 at addr ffff888147a07c00 by task kworker/u4:2/154

CPU: 0 PID: 154 Comm: kworker/u4:2 Not tainted 5.15.113-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+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 kasan_check_range+0x27e/0x290 mm/kasan/generic.c:189
 memcpy+0x25/0x60 mm/kasan/shadow.c:65
 copy_page_from_iter_atomic+0x8e3/0x1230 lib/iov_iter.c:978
 generic_perform_write+0x33a/0x5b0 mm/filemap.c:3784
 __generic_file_write_iter+0x243/0x4f0 mm/filemap.c:3903
 generic_file_write_iter+0xa7/0x1b0 mm/filemap.c:3935
 do_iter_readv_writev+0x594/0x7a0
 do_iter_write+0x1ea/0x760 fs/read_write.c:855
 lo_write_bvec+0x297/0x740 drivers/block/loop.c:316
 lo_write_simple drivers/block/loop.c:338 [inline]
 do_req_filebacked drivers/block/loop.c:656 [inline]
 loop_handle_cmd drivers/block/loop.c:2234 [inline]
 loop_process_work+0x2309/0x2af0 drivers/block/loop.c:2274
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2307
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2454
 kthread+0x3f6/0x4f0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
 </TASK>

Allocated by task 3500:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc+0xba/0xf0 mm/kasan/common.c:513
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 __kmalloc+0x168/0x300 mm/slub.c:4407
 kmalloc include/linux/slab.h:596 [inline]
 hfsplus_read_wrapper+0x4e3/0x13b0 fs/hfsplus/wrapper.c:180
 hfsplus_fill_super+0x38a/0x1c90 fs/hfsplus/super.c:413
 mount_bdev+0x26d/0x3a0 fs/super.c:1378
 legacy_get_tree+0xeb/0x180 fs/fs_context.c:610
 vfs_get_tree+0x88/0x270 fs/super.c:1508
 do_new_mount+0x28b/0xad0 fs/namespace.c:2994
 do_mount fs/namespace.c:3337 [inline]
 __do_sys_mount fs/namespace.c:3545 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3522
 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+0x61/0xcb

Last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:2994 [inline]
 call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3074
 percpu_ref_put_many include/linux/percpu-refcount.h:322 [inline]
 percpu_ref_put+0x207/0x210 include/linux/percpu-refcount.h:338
 rcu_do_batch kernel/rcu/tree.c:2510 [inline]
 rcu_core+0xa15/0x1650 kernel/rcu/tree.c:2750
 __do_softirq+0x3b3/0x93a kernel/softirq.c:558

The buggy address belongs to the object at ffff888147a07c00
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 0 bytes inside of
 512-byte region [ffff888147a07c00, ffff888147a07e00)
The buggy address belongs to the page:
page:ffffea00051e8100 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x147a04
head:ffffea00051e8100 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x57ff00000010200(slab|head|node=1|zone=2|lastcpupid=0x7ff)
raw: 057ff00000010200 0000000000000000 0000000f00000001 ffff888011c41c80
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, ts 9033224033, free_ts 0
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5421
 alloc_page_interleave+0x22/0x1c0 mm/mempolicy.c:2031
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc_trace+0x1a0/0x290 mm/slub.c:3245
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 device_private_init drivers/base/core.c:3238 [inline]
 device_add+0xb5/0xfd0 drivers/base/core.c:3288
 device_create_groups_vargs drivers/base/core.c:4053 [inline]
 device_create+0x253/0x2e0 drivers/base/core.c:4095
 mon_bin_add+0xad/0x120 drivers/usb/mon/mon_bin.c:1364
 mon_bus0_init drivers/usb/mon/mon_main.c:322 [inline]
 mon_init+0x141/0x28a drivers/usb/mon/mon_main.c:360
 do_one_initcall+0x22b/0x7a0 init/main.c:1306
 do_initcall_level+0x157/0x207 init/main.c:1379
 do_initcalls+0x49/0x86 init/main.c:1395
 kernel_init_freeable+0x43c/0x5c5 init/main.c:1619
 kernel_init+0x19/0x290 init/main.c:1510
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888147a07d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888147a07d80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888147a07e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                   ^
 ffff888147a07e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888147a07f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (11):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/05/28 14:03 linux-5.15.y 1fe619a7d252 cf184559 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan KASAN: slab-out-of-bounds Read in copy_page_from_iter_atomic
2023/05/08 07:51 linux-5.15.y 8a7f2a5c5aa1 90c93c40 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan-arm64 KASAN: slab-out-of-bounds Read in copy_page_from_iter_atomic
2023/08/19 17:39 linux-5.15.y f6f7927ac664 d216d8a0 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan-arm64 KASAN: slab-out-of-bounds Read in copy_page_from_iter_atomic
2023/06/07 05:09 linux-5.15.y d7af3e5ba454 a4ae4f42 .config console log report syz [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan KASAN: use-after-free Read in copy_page_from_iter_atomic
2023/08/05 00:38 linux-5.15.y 38d4ca22a528 cdae481e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: slab-out-of-bounds Read in copy_page_from_iter_atomic
2023/07/19 00:16 linux-5.15.y d54cfc420586 022df2bb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: slab-out-of-bounds Read in copy_page_from_iter_atomic
2023/06/27 04:06 linux-5.15.y f67653019430 4cd5bb25 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: slab-out-of-bounds Read in copy_page_from_iter_atomic
2023/03/20 18:08 linux-5.15.y 8020ae3c051d 7939252e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: slab-out-of-bounds Read in copy_page_from_iter_atomic
2023/08/07 19:28 linux-5.15.y 38d4ca22a528 b1b6ae3d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: slab-out-of-bounds Read in copy_page_from_iter_atomic
2023/04/27 13:23 linux-5.15.y f48aeeaaa64c 6f3d6fa7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in copy_page_from_iter_atomic
2023/03/25 01:56 linux-5.15.y 115472395b0a 9700afae .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in copy_page_from_iter_atomic
* Struck through repros no longer work on HEAD.