syzbot


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

Status: fixed on 2023/06/07 17:22
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+fbd9585f2b17c63340f0@syzkaller.appspotmail.com
Fix commit: 3967d330baf2 ext4: add inode table check in __ext4_get_inode_loc to aovid possible infinite loop
First crash: 447d, last: 367d
Cause bisection: failed (error log, bisect log)
  
Similar bugs (6)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: slab-out-of-bounds Read in get_max_inline_xattr_value_size ext4 C error 1 426d 426d 0/1 upstream: reported C repro on 2023/01/27 02:26
upstream KASAN: slab-out-of-bounds Read in get_max_inline_xattr_value_size ext4 C 21 326d 364d 22/26 fixed on 2023/07/01 16:05
android-54 KASAN: use-after-free Read in get_max_inline_xattr_value_size ext4 C 20 368d 447d 2/2 fixed on 2023/06/07 17:22
android-54 KASAN: use-after-free Read in get_max_inline_xattr_value_size (2) C 3 249d 257d 0/2 auto-obsoleted due to no activity on 2023/10/31 04:10
android-6-1 KASAN: use-after-free Read in get_max_inline_xattr_value_size origin:lts C error done 10 168d 257d 0/2 auto-obsoleted due to no activity on 2024/01/19 14:48
android-5-15 KASAN: use-after-free Read in get_max_inline_xattr_value_size ext4 C error 4 367d 447d 2/2 fixed on 2023/06/07 17:22

Sample crash report:
EXT4-fs (loop0): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop0): ext4_xattr_ibody_get:593: inode #18: comm syz-executor213: corrupted in-inode xattr
==================================================================
BUG: KASAN: slab-out-of-bounds in get_max_inline_xattr_value_size+0x387/0x530 fs/ext4/inline.c:61
Read of size 4 at addr ffff88811dd24084 by task syz-executor213/371

CPU: 0 PID: 371 Comm: syz-executor213 Not tainted 5.10.161-syzkaller-00019-g416c4356f372 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/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_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308
 get_max_inline_xattr_value_size+0x387/0x530 fs/ext4/inline.c:61
 ext4_get_max_inline_size+0x142/0x200 fs/ext4/inline.c:112
 ext4_da_write_inline_data_begin+0x1c0/0x750 fs/ext4/inline.c:900
 ext4_da_write_begin+0x532/0xf10 fs/ext4/inode.c:3039
 generic_perform_write+0x309/0x5b0 mm/filemap.c:3468
 ext4_buffered_write_iter+0x47c/0x610 fs/ext4/file.c:272
 ext4_file_write_iter+0x192/0x1c70 fs/ext4/file.c:689
 call_write_iter include/linux/fs.h:1969 [inline]
 new_sync_write fs/read_write.c:518 [inline]
 vfs_write+0xc4a/0xf80 fs/read_write.c:605
 ksys_write+0x198/0x2c0 fs/read_write.c:658
 __do_sys_write fs/read_write.c:670 [inline]
 __se_sys_write fs/read_write.c:667 [inline]
 __x64_sys_write+0x7b/0x90 fs/read_write.c:667
 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xc6
RIP: 0033:0x7f0bf6083ab9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 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:00007ffe4a46e118 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 000000000000d78b RCX: 00007f0bf6083ab9
RDX: 0000000000000010 RSI: 0000000020000100 RDI: 0000000000000004
RBP: 0000000000000000 R08: 00007ffe4a46e140 R09: 00007ffe4a46e140
R10: 00007ffe4a46e140 R11: 0000000000000246 R12: 00007ffe4a46e13c
R13: 00007ffe4a46e170 R14: 00007ffe4a46e150 R15: 0000000000000001

Allocated by task 0:
(stack is not available)

The buggy address belongs to the object at ffff88811dd24000
 which belongs to the cache seq_file of size 136
The buggy address is located 132 bytes inside of
 136-byte region [ffff88811dd24000, ffff88811dd24088)
The buggy address belongs to the page:
page:ffffea0004774900 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11dd24
flags: 0x8000000000000200(slab)
raw: 8000000000000200 dead000000000100 dead000000000122 ffff88810017ea80
raw: 0000000000000000 0000000080140014 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 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 160, ts 55600912345, free_ts 55506420601
 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
 kmem_cache_zalloc include/linux/slab.h:654 [inline]
 seq_open+0x61/0x130 fs/seq_file.c:63
 kernfs_fop_open+0x505/0xab0 fs/kernfs/file.c:686
 do_dentry_open+0x7a2/0x1090 fs/open.c:819
 vfs_open+0x73/0x80 fs/open.c:942
 do_open fs/namei.c:3329 [inline]
 path_openat+0x2638/0x2fd0 fs/namei.c:3448
 do_filp_open+0x200/0x440 fs/namei.c:3475
 do_sys_openat2+0x13b/0x470 fs/open.c:1211
 do_sys_open fs/open.c:1227 [inline]
 __do_sys_openat fs/open.c:1243 [inline]
 __se_sys_openat fs/open.c:1238 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1238
 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xc6
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:28 [inline]
 free_pages_prepare mm/page_alloc.c:1332 [inline]
 free_pcp_prepare+0x18c/0x1c0 mm/page_alloc.c:1406
 free_unref_page_prepare mm/page_alloc.c:3293 [inline]
 free_unref_page_list+0x11d/0x660 mm/page_alloc.c:3367
 release_pages+0xc24/0xc60 mm/swap.c:1082
 __pagevec_release+0x81/0xf0 mm/swap.c:1102
 pagevec_release include/linux/pagevec.h:88 [inline]
 __invalidate_mapping_pages+0xa16/0xaf0 mm/truncate.c:607
 invalidate_mapping_pages+0x27/0x30 mm/truncate.c:632
 invalidate_bdev+0xa3/0x140 fs/block_dev.c:97
 ext4_put_super+0x69c/0xcc0 fs/ext4/super.c:1244
 generic_shutdown_super+0x14f/0x2d0 fs/super.c:465
 kill_block_super+0x80/0xe0 fs/super.c:1447
 deactivate_locked_super+0xb0/0x100 fs/super.c:335
 deactivate_super+0xa5/0xd0 fs/super.c:366
 cleanup_mnt+0x45f/0x510 fs/namespace.c:1118
 __cleanup_mnt+0x19/0x20 fs/namespace.c:1125
 task_work_run+0x147/0x1b0 kernel/task_work.c:154
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_user_mode_loop+0xc8/0xe0 kernel/entry/common.c:164

Memory state around the buggy address:
 ffff88811dd23f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88811dd24000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88811dd24080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                   ^
 ffff88811dd24100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88811dd24180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/03/26 14:34 android12-5.10-lts 416c4356f372 fbf0499a .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-10 KASAN: slab-out-of-bounds Read in get_max_inline_xattr_value_size
2023/01/06 08:57 android12-5.10-lts 003c389455eb 1dac8c7a .config console log report syz C [mounted in repro] ci2-android-5-10 KASAN: slab-out-of-bounds Read in get_max_inline_xattr_value_size
2023/03/26 13:03 android12-5.10-lts 416c4356f372 fbf0499a .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-10 KASAN: use-after-free Read in get_max_inline_xattr_value_size
2023/01/16 07:37 android12-5.10-lts 416c4356f372 a63719e7 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-10 KASAN: use-after-free Read in get_max_inline_xattr_value_size
* Struck through repros no longer work on HEAD.