syzbot


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

Status: fixed on 2023/06/13 08:16
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+39411a8923ea201bae8e@syzkaller.appspotmail.com
Fix commit: 0dde3141c527 ext4: avoid a potential slab-out-of-bounds in ext4_group_desc_csum
First crash: 425d, last: 315d
Cause bisection: failed (error log, bisect log)
  
Fix bisection the fix commit could be any of (bisect log):
  416c4356f372 Merge 5.10.161 into android12-5.10-lts
  90eb02302b5e Revert "HID: core: Provide new max_buffer_size attribute to over-ride the default"
  
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-54 KASAN: use-after-free Read in ext4_group_desc_csum 6 363d 416d 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 336d 437d 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 355d 425d 2/2 fixed on 2023/06/16 14:10
linux-5.15 KASAN: use-after-free Read in ext4_group_desc_csum 1 356d 356d 0/3 auto-obsoleted due to no activity on 2023/08/22 11:08
Last patch testing requests (1)
Created Duration User Patch Repo Result
2023/05/15 11:07 16m retest repro android13-5.10-lts OK log

Sample crash report:
ext4 filesystem being mounted at /root/syzkaller.6gkWXP/bus supports timestamps until 2038 (0x7fffffff)
==================================================================
BUG: KASAN: use-after-free in crc16+0x235/0x2d0 lib/crc16.c:58
Read of size 1 at addr ffff88811d865000 by task syz-executor115/366

CPU: 1 PID: 366 Comm: syz-executor115 Not tainted 5.10.161-syzkaller-00019-g416c4356f372 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
 print_address_description+0x81/0x3c0 mm/kasan/report.c:233
 __kasan_report mm/kasan/report.c:419 [inline]
 kasan_report+0x1a4/0x1f0 mm/kasan/report.c:436
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report_generic.c:306
 crc16+0x235/0x2d0 lib/crc16.c:58
 ext4_group_desc_csum+0x851/0xb50 fs/ext4/super.c:2850
 ext4_group_desc_csum_set+0x1d6/0x270 fs/ext4/super.c:2873
 ext4_free_blocks+0x1b9e/0x2ad0 fs/ext4/mballoc.c:5527
 ext4_remove_blocks+0xaf1/0x1180 fs/ext4/extents.c:2520
 ext4_ext_rm_leaf+0xaa8/0x18c0 fs/ext4/extents.c:2704
 ext4_ext_remove_space+0xf25/0x22a0 fs/ext4/extents.c:2952
 ext4_ext_truncate+0x18a/0x210 fs/ext4/extents.c:4413
 ext4_truncate+0xba0/0x1270 fs/ext4/inode.c:4356
 ext4_evict_inode+0xf1e/0x1730 fs/ext4/inode.c:288
 evict+0x2a3/0x6c0 fs/inode.c:577
 iput_final fs/inode.c:1655 [inline]
 iput+0x61f/0x7d0 fs/inode.c:1681
 do_unlinkat+0x51a/0x920 fs/namei.c:3982
 __do_sys_unlink fs/namei.c:4022 [inline]
 __se_sys_unlink fs/namei.c:4020 [inline]
 __x64_sys_unlink+0x49/0x50 fs/namei.c:4020
 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xc6
RIP: 0033:0x7f0a90ab5ea9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 01 18 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc38cbe7d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000057
RAX: ffffffffffffffda RBX: 00007f0a90b1ded0 RCX: 00007f0a90ab5ea9
RDX: ffffffffffffffc0 RSI: 0000000000000080 RDI: 0000000020000200
RBP: 00007ffc38cbe7f8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffc38cbe820
R13: 00007ffc38cbe820 R14: 00007f0a90af30e8 R15: 00007ffc38cbe800

Allocated by task 368:
 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:428 [inline]
 __kasan_slab_alloc+0xb2/0xe0 mm/kasan/common.c:461
 kasan_slab_alloc include/linux/kasan.h:259 [inline]
 slab_post_alloc_hook include/../mm/slab.h:583 [inline]
 slab_alloc_node mm/slub.c:2956 [inline]
 slab_alloc mm/slub.c:2964 [inline]
 kmem_cache_alloc+0x16c/0x300 mm/slub.c:2969
 mempool_alloc_slab+0x1d/0x30 mm/mempool.c:513
 mempool_alloc+0x135/0x530 mm/mempool.c:393
 bio_alloc_bioset+0x1db/0x650 block/bio.c:486
 bio_alloc include/linux/bio.h:407 [inline]
 mpage_alloc fs/mpage.c:115 [inline]
 do_mpage_readpage+0x14e6/0x1b50 fs/mpage.c:342
 mpage_readahead+0x2d5/0x5f0 fs/mpage.c:427
 blkdev_readahead+0x1c/0x20 fs/block_dev.c:651
 read_pages+0x160/0xb60 mm/readahead.c:140
 page_cache_ra_unbounded+0x6d0/0x8b0 mm/readahead.c:248
 do_page_cache_ra mm/readahead.c:277 [inline]
 force_page_cache_ra+0x3e6/0x440 mm/readahead.c:308
 page_cache_sync_ra+0x253/0x2c0 mm/readahead.c:584
 page_cache_sync_readahead include/linux/pagemap.h:837 [inline]
 generic_file_buffered_read+0x65f/0x2850 mm/filemap.c:2247
 generic_file_read_iter+0x106/0x6d0 mm/filemap.c:2565
 blkdev_read_iter+0x135/0x190 fs/block_dev.c:1954
 call_read_iter include/linux/fs.h:1963 [inline]
 new_sync_read fs/read_write.c:415 [inline]
 vfs_read+0x9e2/0xbf0 fs/read_write.c:496
 ksys_read+0x198/0x2c0 fs/read_write.c:634
 __do_sys_read fs/read_write.c:644 [inline]
 __se_sys_read fs/read_write.c:642 [inline]
 __x64_sys_read+0x7b/0x90 fs/read_write.c:642
 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xc6

Freed by task 18:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:357
 ____kasan_slab_free+0x121/0x160 mm/kasan/common.c:360
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:368
 kasan_slab_free include/linux/kasan.h:235 [inline]
 slab_free_hook mm/slub.c:1604 [inline]
 slab_free_freelist_hook+0xcc/0x1a0 mm/slub.c:1630
 slab_free mm/slub.c:3212 [inline]
 kmem_cache_free+0xa9/0x1f0 mm/slub.c:3228
 mempool_free_slab+0x1d/0x30 mm/mempool.c:520
 mempool_free+0xd5/0x310 mm/mempool.c:502
 bio_put+0x34e/0x420 block/bio.c:266
 mpage_end_io+0x325/0x5b0 fs/mpage.c:76
 bio_endio+0x465/0x5c0 block/bio.c:1459
 req_bio_endio block/blk-core.c:269 [inline]
 blk_update_request+0x6d5/0x1250 block/blk-core.c:1471
 blk_mq_end_request+0x42/0x80 block/blk-mq.c:568
 lo_complete_rq+0x151/0x2e0 drivers/block/loop.c:488
 blk_done_softirq+0x372/0x410 block/blk-mq.c:592
 __do_softirq+0x27e/0x596 kernel/softirq.c:305

The buggy address belongs to the object at ffff88811d865000
 which belongs to the cache bio-0 of size 216
The buggy address is located 0 bytes inside of
 216-byte region [ffff88811d865000, ffff88811d8650d8)
The buggy address belongs to the page:
page:ffffea0004761940 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11d865
flags: 0x8000000000000200(slab)
raw: 8000000000000200 dead000000000100 dead000000000122 ffff88810017fb00
raw: 0000000000000000 00000000000c000c 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 0x92880(GFP_NOWAIT|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_NOMEMALLOC), pid 368, ts 42599737291, free_ts 0
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2386 [inline]
 prep_new_page mm/page_alloc.c:2392 [inline]
 get_page_from_freelist+0x755/0x810 mm/page_alloc.c:4073
 __alloc_pages_nodemask+0x3b6/0x890 mm/page_alloc.c:5160
 alloc_slab_page mm/slub.c:1815 [inline]
 allocate_slab+0x78/0x540 mm/slub.c:1817
 new_slab mm/slub.c:1878 [inline]
 new_slab_objects mm/slub.c:2636 [inline]
 ___slab_alloc+0x131/0x2e0 mm/slub.c:2800
 __slab_alloc+0x63/0xa0 mm/slub.c:2840
 slab_alloc_node mm/slub.c:2922 [inline]
 slab_alloc mm/slub.c:2964 [inline]
 kmem_cache_alloc+0x1ef/0x300 mm/slub.c:2969
 mempool_alloc_slab+0x1d/0x30 mm/mempool.c:513
 mempool_alloc+0x135/0x530 mm/mempool.c:393
 bio_alloc_bioset+0x1db/0x650 block/bio.c:486
 bio_alloc include/linux/bio.h:407 [inline]
 mpage_alloc fs/mpage.c:115 [inline]
 do_mpage_readpage+0x14e6/0x1b50 fs/mpage.c:342
 mpage_readahead+0x2d5/0x5f0 fs/mpage.c:427
 blkdev_readahead+0x1c/0x20 fs/block_dev.c:651
 read_pages+0x160/0xb60 mm/readahead.c:140
 page_cache_ra_unbounded+0x6d0/0x8b0 mm/readahead.c:248
 do_page_cache_ra mm/readahead.c:277 [inline]
 force_page_cache_ra+0x3e6/0x440 mm/readahead.c:308
 page_cache_sync_ra+0x253/0x2c0 mm/readahead.c:584
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88811d864f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88811d864f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88811d865000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88811d865080: fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc
 ffff88811d865100: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
==================================================================

Crashes (11):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/02/23 01:34 android12-5.10-lts 416c4356f372 9f1e2cb3 .config console log report syz C [mounted in repro] ci2-android-5-10 KASAN: use-after-free Read in ext4_group_desc_csum
2023/02/13 19:35 android12-5.10-lts 416c4356f372 957959cb .config console log report syz [mounted in repro] ci2-android-5-10 KASAN: slab-out-of-bounds Read in ext4_group_desc_csum
2023/06/04 06:34 android13-5.10-lts 43c801dc3325 a4ae4f42 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Read in ext4_group_desc_csum
2023/02/28 11:57 android12-5.10-lts 416c4356f372 95aee97a .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Read in ext4_group_desc_csum
2023/02/27 23:03 android12-5.10-lts 416c4356f372 95aee97a .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in ext4_group_desc_csum
2023/02/27 10:53 android12-5.10-lts 416c4356f372 9189cb53 .config console log report info ci2-android-5-10 KASAN: use-after-free Read in ext4_group_desc_csum
2023/02/25 21:37 android12-5.10-lts 416c4356f372 ee50e71c .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in ext4_group_desc_csum
2023/02/25 20:59 android12-5.10-lts 416c4356f372 ee50e71c .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in ext4_group_desc_csum
2023/02/24 14:58 android12-5.10-lts 416c4356f372 ee50e71c .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in ext4_group_desc_csum
2023/02/24 13:24 android12-5.10-lts 416c4356f372 ee50e71c .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in ext4_group_desc_csum
2023/02/23 01:15 android12-5.10-lts 416c4356f372 9f1e2cb3 .config console log report info ci2-android-5-10 KASAN: use-after-free Read in ext4_group_desc_csum
* Struck through repros no longer work on HEAD.