syzbot


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

Status: upstream: reported C repro on 2023/01/27 02:26
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+49c13794f111572a1514@syzkaller.appspotmail.com
First crash: 448d, last: 448d
Fix bisection: failed (error log, bisect log)
  
Similar bugs (6)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: slab-out-of-bounds Read in get_max_inline_xattr_value_size ext4 C error 4 390d 469d 2/2 fixed on 2023/06/07 17:22
upstream KASAN: slab-out-of-bounds Read in get_max_inline_xattr_value_size ext4 C 21 348d 386d 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 390d 469d 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 271d 279d 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 191d 279d 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 390d 469d 2/2 fixed on 2023/06/07 17:22

Sample crash report:
EXT4-fs (loop0): mounted filesystem without journal. Opts: ,errors=continue
==================================================================
BUG: KASAN: slab-out-of-bounds in get_max_inline_xattr_value_size+0x46a/0x4d0 fs/ext4/inline.c:57
Read of size 4 at addr ffff8880aab02084 by task kworker/1:2/3531

CPU: 1 PID: 3531 Comm: kworker/1:2 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023
Workqueue: events p9_write_work
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load4_noabort+0x88/0x90 mm/kasan/report.c:432
 get_max_inline_xattr_value_size+0x46a/0x4d0 fs/ext4/inline.c:57
 ext4_get_max_inline_size.part.0+0xa8/0x170 fs/ext4/inline.c:108
 ext4_get_max_inline_size fs/ext4/inline.c:96 [inline]
 ext4_try_to_write_inline_data+0xf2/0x1a20 fs/ext4/inline.c:656
 ext4_write_begin+0xe41/0x1610 fs/ext4/inode.c:1294
 ext4_da_write_begin+0x737/0x10e0 fs/ext4/inode.c:3051
 generic_perform_write+0x1f8/0x4d0 mm/filemap.c:3170
 __generic_file_write_iter+0x24b/0x610 mm/filemap.c:3295
 ext4_file_write_iter+0x2fe/0xf20 fs/ext4/file.c:272
 call_write_iter include/linux/fs.h:1821 [inline]
 new_sync_write fs/read_write.c:474 [inline]
 __vfs_write+0x51b/0x770 fs/read_write.c:487
 vfs_write+0x1f3/0x540 fs/read_write.c:549
 kernel_write+0xa6/0x110 fs/read_write.c:526
 p9_fd_write net/9p/trans_fd.c:443 [inline]
 p9_write_work+0x23f/0xb90 net/9p/trans_fd.c:494
 process_one_work+0x864/0x1570 kernel/workqueue.c:2153
 worker_thread+0x64c/0x1130 kernel/workqueue.c:2296
 kthread+0x33f/0x460 kernel/kthread.c:259
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Allocated by task 1:
 kmem_cache_alloc+0x122/0x370 mm/slab.c:3559
 getname_flags+0xce/0x590 fs/namei.c:140
 do_sys_open+0x26c/0x520 fs/open.c:1079
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 1:
 __cache_free mm/slab.c:3503 [inline]
 kmem_cache_free+0x7f/0x260 mm/slab.c:3765
 putname+0xe1/0x120 fs/namei.c:261
 do_sys_open+0x2ba/0x520 fs/open.c:1094
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880aab02100
 which belongs to the cache names_cache of size 4096
The buggy address is located 124 bytes to the left of
 4096-byte region [ffff8880aab02100, ffff8880aab03100)
The buggy address belongs to the page:
page:ffffea0002aac080 count:1 mapcount:0 mapping:ffff88823b843380 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffffea00024bbe88 ffffea0002a5ce08 ffff88823b843380
raw: 0000000000000000 ffff8880aab02100 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880aab01f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880aab02000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880aab02080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                   ^
 ffff8880aab02100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880aab02180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/01/27 02:26 linux-4.19.y 3f8a27f9e27b 9dfcf09c .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 KASAN: slab-out-of-bounds Read in get_max_inline_xattr_value_size
* Struck through repros no longer work on HEAD.