syzbot


KASAN: use-after-free Read in ext4_group_desc_csum

Status: auto-obsoleted due to no activity on 2023/08/22 11:08
Reported-by: syzbot+133b68d1e29d73b59101@syzkaller.appspotmail.com
First crash: 360d, last: 360d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: slab-out-of-bounds Read in ext4_group_desc_csum ext4 C error inconclusive 11 319d 421d 2/2 fixed on 2023/06/13 08:16
android-54 KASAN: use-after-free Read in ext4_group_desc_csum 6 367d 421d 0/2 auto-obsoleted due to no activity on 2023/08/15 14:19
upstream KASAN: slab-out-of-bounds Read in ext4_group_desc_csum ext4 C error 26 340d 441d 22/26 fixed on 2023/07/01 16:05
android-5-15 KASAN: use-after-free Read in ext4_group_desc_csum ext4 origin:upstream C error 4 359d 430d 2/2 fixed on 2023/06/16 14:10

Sample crash report:
ext4 filesystem being mounted at /root/syzkaller-testdir298027843/syzkaller.VIH6zx/58/bus supports timestamps until 2038 (0x7fffffff)
==================================================================
BUG: KASAN: use-after-free in crc16+0x1bc/0x270 lib/crc16.c:58
Read of size 1 at addr ffff88801a9f7000 by task syz-executor.4/5513

CPU: 1 PID: 5513 Comm: syz-executor.4 Not tainted 5.15.108-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
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
 crc16+0x1bc/0x270 lib/crc16.c:58
 ext4_group_desc_csum+0x90b/0xc40 fs/ext4/super.c:2841
 ext4_group_desc_csum_set+0x197/0x230 fs/ext4/super.c:2864
 ext4_mb_mark_diskspace_used+0xbe7/0x14c0 fs/ext4/mballoc.c:3861
 ext4_mb_new_blocks+0x14d0/0x4d50 fs/ext4/mballoc.c:5641
 ext4_ext_map_blocks+0x1986/0x7220 fs/ext4/extents.c:4287
 ext4_map_blocks+0xaad/0x1e30 fs/ext4/inode.c:645
 _ext4_get_block+0x23b/0x660 fs/ext4/inode.c:802
 ext4_block_write_begin+0x6b0/0x13a0 fs/ext4/inode.c:1087
 ext4_write_begin+0x6c6/0x15f0
 ext4_da_write_begin+0x342/0xb60 fs/ext4/inode.c:2973
 generic_perform_write+0x2bf/0x5b0 mm/filemap.c:3776
 ext4_buffered_write_iter+0x22e/0x380 fs/ext4/file.c:269
 ext4_file_write_iter+0x87c/0x1990
 do_iter_readv_writev+0x594/0x7a0
 do_iter_write+0x1ea/0x760 fs/read_write.c:855
 vfs_writev fs/read_write.c:928 [inline]
 do_writev+0x281/0x470 fs/read_write.c:971
 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
RIP: 0033:0x7ff68d2ea169
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ff68b85c168 EFLAGS: 00000246 ORIG_RAX: 0000000000000014
RAX: ffffffffffffffda RBX: 00007ff68d409f80 RCX: 00007ff68d2ea169
RDX: 0000000000000005 RSI: 0000000020000300 RDI: 0000000000000006
RBP: 00007ff68d345ca1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffda58ba3cf R14: 00007ff68b85c300 R15: 0000000000022000
 </TASK>

Allocated by task 4018:
 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]
 kzalloc include/linux/slab.h:721 [inline]
 tomoyo_encode2 security/tomoyo/realpath.c:45 [inline]
 tomoyo_encode+0x26b/0x530 security/tomoyo/realpath.c:80
 tomoyo_realpath_from_path+0x5a2/0x5e0 security/tomoyo/realpath.c:288
 tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
 tomoyo_path_number_perm+0x225/0x810 security/tomoyo/file.c:723
 security_file_ioctl+0x6d/0xa0 security/security.c:1555
 __do_sys_ioctl fs/ioctl.c:868 [inline]
 __se_sys_ioctl+0x47/0x160 fs/ioctl.c:860
 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

Freed by task 4018:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kfree+0xf1/0x270 mm/slub.c:4559
 tomoyo_path_number_perm+0x648/0x810 security/tomoyo/file.c:736
 security_file_ioctl+0x6d/0xa0 security/security.c:1555
 __do_sys_ioctl fs/ioctl.c:868 [inline]
 __se_sys_ioctl+0x47/0x160 fs/ioctl.c:860
 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

The buggy address belongs to the object at ffff88801a9f7000
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes inside of
 32-byte region [ffff88801a9f7000, ffff88801a9f7020)
The buggy address belongs to the page:
page:ffffea00006a7dc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1a9f7
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea00007a6b40 0000001a0000001a ffff888011c41500
raw: 0000000000000000 0000000000400040 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 4901, ts 238256160244, free_ts 238254112882
 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_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]
 io_drain_req+0x43e/0x970 io_uring/io_uring.c:6761
 io_queue_sqe io_uring/io_uring.c:7238 [inline]
 io_submit_sqe io_uring/io_uring.c:7419 [inline]
 io_submit_sqes+0x68ac/0xa410 io_uring/io_uring.c:7525
 __do_sys_io_uring_enter io_uring/io_uring.c:10254 [inline]
 __se_sys_io_uring_enter+0x28b/0x21c0 io_uring/io_uring.c:10196
 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
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 __vunmap+0x8d4/0xa20 mm/vmalloc.c:2621
 free_work+0x57/0x80 mm/vmalloc.c:95
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2306
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2453
 kthread+0x3f6/0x4f0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Memory state around the buggy address:
 ffff88801a9f6f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88801a9f6f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88801a9f7000: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
                   ^
 ffff88801a9f7080: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
 ffff88801a9f7100: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/04/24 11:08 linux-5.15.y 3299fb36854f 2b32bd34 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in ext4_group_desc_csum
* Struck through repros no longer work on HEAD.