syzbot


KASAN: use-after-free Read in ext4_group_desc_csum

Status: fixed on 2023/06/16 14:10
Bug presence: origin:upstream
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+fc51227e7100c9294894@syzkaller.appspotmail.com
Fix commit: 75d202bb9b43 UPSTREAM: ext4: avoid a potential slab-out-of-bounds in ext4_group_desc_csum
First crash: 647d, last: 576d
Cause bisection: failed (error log, bisect log)
  
Discussions (1)
Title Replies (including bot) Last reply
[PATCH] ext4: Avoid a potential slab-out-of-bounds in ext4_group_desc_csum 2 (2) 2023/05/13 04:59
Bug presence (2)
Date Name Commit Repro Result
2023/05/04 lts (merge base) d86dfc4d95cd C [report] KASAN: use-after-free Read in ext4_group_desc_csum
2023/05/04 upstream (ToT) 1a5304fecee5 C [report] KASAN: slab-out-of-bounds Read in ext4_group_desc_csum
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 536d 638d 2/2 fixed on 2023/06/13 08:16
android-54 KASAN: use-after-free Read in ext4_group_desc_csum 6 584d 638d 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 557d 658d 22/28 fixed on 2023/07/01 16:05
linux-5.15 KASAN: use-after-free Read in ext4_group_desc_csum 1 577d 577d 0/3 auto-obsoleted due to no activity on 2023/08/22 11:08
Fix bisection attempts (1)
Created Duration User Patch Repo Result
2023/03/25 02:07 16m bisect fix android13-5.15-lts OK (0) job log log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in crc16+0x216/0x2a0 lib/crc16.c:58
Read of size 1 at addr ffff88811eeb9000 by task syz-executor404/328

CPU: 0 PID: 328 Comm: syz-executor404 Not tainted 5.15.94-syzkaller-03204-g5448b2fda85f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description+0x87/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:427 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:444
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report_generic.c:306
 crc16+0x216/0x2a0 lib/crc16.c:58
 ext4_group_desc_csum+0x882/0xb90 fs/ext4/super.c:2840
 ext4_group_desc_csum_set+0x1d8/0x270 fs/ext4/super.c:2863
 ext4_free_blocks+0x1c48/0x2ce0 fs/ext4/mballoc.c:6113
 ext4_remove_blocks fs/ext4/extents.c:2525 [inline]
 ext4_ext_rm_leaf fs/ext4/extents.c:2709 [inline]
 ext4_ext_remove_space+0x29b2/0x4a60 fs/ext4/extents.c:2957
 ext4_ext_truncate+0x19a/0x240 fs/ext4/extents.c:4419
 ext4_truncate+0x96c/0xfa0 fs/ext4/inode.c:4276
 ext4_evict_inode+0xcee/0x14e0 fs/ext4/inode.c:290
 evict+0x2a3/0x630 fs/inode.c:587
 iput_final fs/inode.c:1663 [inline]
 iput+0x63b/0x7e0 fs/inode.c:1689
 do_unlinkat+0x4db/0x910 fs/namei.c:4228
 __do_sys_unlink fs/namei.c:4269 [inline]
 __se_sys_unlink fs/namei.c:4267 [inline]
 __x64_sys_unlink+0x49/0x50 fs/namei.c:4267
 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:0x7fa894d97519
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 14 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:00007fff8175b138 EFLAGS: 00000246 ORIG_RAX: 0000000000000057
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fa894d97519
RDX: ffffffffffffffc0 RSI: 0000000000000080 RDI: 0000000020000200
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fff8175b170
R13: 0000000000000000 R14: 431bde82d7b634db R15: 0000000000000000
 </TASK>

Allocated by task 328:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:433 [inline]
 __kasan_slab_alloc+0xb1/0xe0 mm/kasan/common.c:466
 kasan_slab_alloc include/linux/kasan.h:217 [inline]
 slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:550
 slab_alloc_node mm/slub.c:3238 [inline]
 slab_alloc mm/slub.c:3246 [inline]
 kmem_cache_alloc+0xf5/0x200 mm/slub.c:3251
 mempool_alloc_slab+0x1d/0x30 mm/mempool.c:513
 mempool_alloc+0x149/0x550 mm/mempool.c:393
 bio_alloc_bioset+0x12a/0x950 block/bio.c:469
 bio_alloc include/linux/bio.h:429 [inline]
 submit_bh_wbc+0x1d1/0x6c0 fs/buffer.c:3028
 submit_bh+0x28/0x40 fs/buffer.c:3062
 __ext4_read_bh fs/ext4/super.c:155 [inline]
 ext4_read_bh+0x197/0x240 fs/ext4/super.c:179
 ext4_read_bh_lock fs/ext4/super.c:194 [inline]
 __ext4_sb_bread_gfp+0x1cf/0x220 fs/ext4/super.c:216
 ext4_sb_bread_unmovable fs/ext4/super.c:233 [inline]
 ext4_fill_super+0x34d2/0x9680 fs/ext4/super.c:4346
 mount_bdev+0x281/0x3b0 fs/super.c:1369
 ext4_mount+0x34/0x40 fs/ext4/super.c:6564
 legacy_get_tree+0xf1/0x190 fs/fs_context.c:610
 vfs_get_tree+0x88/0x290 fs/super.c:1499
 do_new_mount+0x28b/0xac0 fs/namespace.c:2994
 path_mount+0x671/0x1070 fs/namespace.c:3324
 do_mount fs/namespace.c:3337 [inline]
 __do_sys_mount fs/namespace.c:3545 [inline]
 __se_sys_mount+0x2c4/0x3b0 fs/namespace.c:3522
 __x64_sys_mount+0xbf/0xd0 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

Freed by task 13:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x126/0x160 mm/kasan/common.c:365
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:373
 kasan_slab_free include/linux/kasan.h:193 [inline]
 slab_free_hook mm/slub.c:1723 [inline]
 slab_free_freelist_hook+0xbd/0x190 mm/slub.c:1749
 slab_free mm/slub.c:3517 [inline]
 kmem_cache_free+0x116/0x2e0 mm/slub.c:3533
 mempool_free_slab+0x1d/0x30 mm/mempool.c:520
 mempool_free+0xd7/0x310 mm/mempool.c:502
 bio_free+0x153/0x1a0 block/bio.c:239
 bio_put+0x9a/0x4b0 block/bio.c:700
 end_bio_bh_io_sync+0xbf/0x110 fs/buffer.c:3008
 bio_endio+0x64a/0x670 block/bio.c:1479
 req_bio_endio block/blk-core.c:264 [inline]
 blk_update_request+0x683/0x1200 block/blk-core.c:1443
 blk_mq_end_request+0x43/0x80 block/blk-mq.c:577
 lo_complete_rq+0x151/0x270 drivers/block/loop.c:530
 blk_complete_reqs block/blk-mq.c:589 [inline]
 blk_done_softirq+0xfd/0x140 block/blk-mq.c:594
 __do_softirq+0x26d/0x5bf kernel/softirq.c:565

The buggy address belongs to the object at ffff88811eeb9000
 which belongs to the cache bio-224 of size 224
The buggy address is located 0 bytes inside of
 224-byte region [ffff88811eeb9000, ffff88811eeb90e0)
The buggy address belongs to the page:
page:ffffea00047bae40 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11eeb9
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 0000000000000000 dead000000000122 ffff8881003a6000
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 0x92800(GFP_NOWAIT|__GFP_NOWARN|__GFP_NORETRY|__GFP_NOMEMALLOC), pid 328, ts 24057221355, free_ts 24057165969
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2502
 prep_new_page mm/page_alloc.c:2508 [inline]
 get_page_from_freelist+0x2c14/0x2cf0 mm/page_alloc.c:4291
 __alloc_pages+0x386/0x7b0 mm/page_alloc.c:5569
 allocate_slab mm/slub.c:1930 [inline]
 new_slab+0x92/0x490 mm/slub.c:1993
 ___slab_alloc+0x39e/0x830 mm/slub.c:3026
 __slab_alloc+0x4a/0x90 mm/slub.c:3113
 slab_alloc_node mm/slub.c:3204 [inline]
 slab_alloc mm/slub.c:3246 [inline]
 kmem_cache_alloc+0x134/0x200 mm/slub.c:3251
 mempool_alloc_slab+0x1d/0x30 mm/mempool.c:513
 mempool_alloc+0x149/0x550 mm/mempool.c:393
 bio_alloc_bioset+0x12a/0x950 block/bio.c:469
 bio_alloc include/linux/bio.h:429 [inline]
 submit_bh_wbc+0x1d1/0x6c0 fs/buffer.c:3028
 submit_bh+0x28/0x40 fs/buffer.c:3062
 __ext4_read_bh fs/ext4/super.c:155 [inline]
 ext4_read_bh+0x197/0x240 fs/ext4/super.c:179
 ext4_read_bh_lock fs/ext4/super.c:194 [inline]
 __ext4_sb_bread_gfp+0x1cf/0x220 fs/ext4/super.c:216
 ext4_sb_bread_unmovable fs/ext4/super.c:233 [inline]
 ext4_fill_super+0x7a5/0x9680 fs/ext4/super.c:3951
 mount_bdev+0x281/0x3b0 fs/super.c:1369
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1370 [inline]
 free_pcp_prepare mm/page_alloc.c:1442 [inline]
 free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3441
 free_unref_page_list+0x15d/0x980 mm/page_alloc.c:3562
 release_pages+0x1310/0x1370 mm/swap.c:1009
 __pagevec_release+0x84/0x100 mm/swap.c:1029
 pagevec_release include/linux/pagevec.h:81 [inline]
 truncate_inode_pages_range+0x482/0x1160 mm/truncate.c:329
 truncate_inode_pages+0x24/0x30 mm/truncate.c:425
 kill_bdev block/bdev.c:77 [inline]
 set_blocksize+0x30d/0x380 block/bdev.c:157
 sb_set_blocksize block/bdev.c:166 [inline]
 sb_min_blocksize+0xd7/0x190 block/bdev.c:182
 ext4_fill_super+0x707/0x9680 fs/ext4/super.c:3934
 mount_bdev+0x281/0x3b0 fs/super.c:1369
 ext4_mount+0x34/0x40 fs/ext4/super.c:6564
 legacy_get_tree+0xf1/0x190 fs/fs_context.c:610
 vfs_get_tree+0x88/0x290 fs/super.c:1499
 do_new_mount+0x28b/0xac0 fs/namespace.c:2994
 path_mount+0x671/0x1070 fs/namespace.c:3324
 do_mount fs/namespace.c:3337 [inline]
 __do_sys_mount fs/namespace.c:3545 [inline]
 __se_sys_mount+0x2c4/0x3b0 fs/namespace.c:3522

Memory state around the buggy address:
 ffff88811eeb8f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88811eeb8f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88811eeb9000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88811eeb9080: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff88811eeb9100: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/02/23 02:07 android13-5.15-lts 5448b2fda85f 9f1e2cb3 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-15 KASAN: use-after-free Read in ext4_group_desc_csum
2023/02/13 20:14 android13-5.15-lts 5020746bff95 957959cb .config console log report syz C [mounted in repro] ci2-android-5-15 KASAN: use-after-free Read in ext4_group_desc_csum
2023/04/25 07:59 android13-5.15-lts 7364b7abbafb 65320f8e .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in ext4_group_desc_csum
2023/03/30 20:30 android13-5.15-lts 7364b7abbafb f325deb0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in ext4_group_desc_csum
* Struck through repros no longer work on HEAD.