syzbot


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

Status: upstream: reported C repro on 2024/04/14 08:35
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+1d1e7860ae72567466db@syzkaller.appspotmail.com
First crash: 221d, last: 34d
Fix bisection: failed (error log, bisect log)
  
Bug presence (2)
Date Name Commit Repro Result
2024/04/15 lts (merge base) 883d1a956208 C [report] KASAN: slab-out-of-bounds Read in ext4_inlinedir_to_tree
2024/04/14 upstream (ToT) 0bbac3facb5d C [report] KASAN: slab-out-of-bounds Read in ext4_read_inline_data
Similar bugs (6)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-54 KASAN: slab-out-of-bounds Read in ext4_inlinedir_to_tree C 1 66d 221d 0/2 upstream: reported C repro on 2024/04/14 03:10
upstream KASAN: use-after-free Read in ext4_inlinedir_to_tree ext4 C done 5 31d 84d 0/28 upstream: reported C repro on 2024/08/28 22:55
upstream KMSAN: uninit-value in number (4) kernel C 7189 729d 1107d 0/28 closed as invalid on 2022/11/28 10:01
upstream KMSAN: uninit-value in ext4_inlinedir_to_tree ext4 C 267 159d 205d 27/28 fixed on 2024/08/14 03:44
android-5-10 KASAN: use-after-free Read in ext4_inlinedir_to_tree C error 1 32d 221d 0/2 upstream: reported C repro on 2024/04/14 03:44
upstream KMSAN: uninit-value in htree_dirblock_to_tree ext4 204 557d 687d 22/28 fixed on 2023/07/01 16:05
Last patch testing requests (2)
Created Duration User Patch Repo Result
2024/10/17 19:09 11m retest repro android14-6.1 report log
2024/08/08 18:48 5m retest repro android14-6.1 report log

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in ext4_read_inline_data fs/ext4/inline.c:210 [inline]
BUG: KASAN: slab-out-of-bounds in ext4_inlinedir_to_tree+0x560/0x1160 fs/ext4/inline.c:1394
Read of size 68 at addr ffff888109c91ec9 by task syz-executor357/297

CPU: 0 PID: 297 Comm: syz-executor357 Not tainted 6.1.75-syzkaller-00022-gcfa154389a65 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0x158/0x4e0 mm/kasan/report.c:427
 kasan_report+0x13c/0x170 mm/kasan/report.c:531
 kasan_check_range+0x294/0x2a0 mm/kasan/generic.c:189
 memcpy+0x2d/0x70 mm/kasan/shadow.c:65
 ext4_read_inline_data fs/ext4/inline.c:210 [inline]
 ext4_inlinedir_to_tree+0x560/0x1160 fs/ext4/inline.c:1394
 ext4_htree_fill_tree+0x5d1/0x13e0 fs/ext4/namei.c:1210
 ext4_dx_readdir fs/ext4/dir.c:597 [inline]
 ext4_readdir+0x2f4b/0x3930 fs/ext4/dir.c:142
 iterate_dir+0x265/0x610
 __do_sys_getdents64 fs/readdir.c:369 [inline]
 __se_sys_getdents64+0x1c1/0x460 fs/readdir.c:354
 __x64_sys_getdents64+0x7b/0x90 fs/readdir.c:354
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f2de15643c3
Code: c1 66 0f 1f 44 00 00 48 83 c4 08 48 89 ef 5b 5d e9 c2 39 fb ff 66 90 b8 ff ff ff 7f 48 39 c2 48 0f 47 d0 b8 d9 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 05 c3 0f 1f 40 00 48 c7 c2 b8 ff ff ff f7 d8
RSP: 002b:00007ffdeeaac958 EFLAGS: 00000293 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 0000555555808770 RCX: 00007f2de15643c3
RDX: 0000000000008000 RSI: 0000555555808770 RDI: 0000000000000005
RBP: 0000555555808744 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000001000 R11: 0000000000000293 R12: ffffffffffffffb8
R13: 0000000000000016 R14: 0000555555808740 R15: 431bde82d7b634db
 </TASK>

Allocated by task 8:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_alloc_info+0x1f/0x30 mm/kasan/generic.c:505
 ____kasan_kmalloc mm/kasan/common.c:379 [inline]
 __kasan_kmalloc+0x9c/0xb0 mm/kasan/common.c:388
 kasan_kmalloc include/linux/kasan.h:212 [inline]
 kmalloc_trace+0x44/0xa0 mm/slab_common.c:1052
 kmalloc include/linux/slab.h:553 [inline]
 create_new_subsystem kernel/trace/trace_events.c:2269 [inline]
 event_subsystem_dir kernel/trace/trace_events.c:2328 [inline]
 event_create_dir+0x324/0xf10 kernel/trace/trace_events.c:2428
 __trace_early_add_event_dirs+0x79/0x1f0 kernel/trace/trace_events.c:3506
 early_event_add_tracer+0x54/0x73 kernel/trace/trace_events.c:3667
 event_trace_init+0xe8/0x165 kernel/trace/trace_events.c:3824
 tracer_init_tracefs_work_func+0x11/0x13f kernel/trace/trace.c:9887
 process_one_work+0x73d/0xcb0 kernel/workqueue.c:2299
 worker_thread+0xa60/0x1260 kernel/workqueue.c:2446
 kthread+0x26d/0x300 kernel/kthread.c:386
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

The buggy address belongs to the object at ffff888109c91e80
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 9 bytes to the right of
 64-byte region [ffff888109c91e80, ffff888109c91ec0)

The buggy address belongs to the physical page:
page:ffffea0004272440 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888109c91800 pfn:0x109c91
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 ffffea0004271700 dead000000000004 ffff888100042780
raw: ffff888109c91800 0000000080200007 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 1, tgid 1 (swapper/0), ts 1437617996, free_ts 0
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x213/0x220 mm/page_alloc.c:2590
 prep_new_page+0x1b/0x110 mm/page_alloc.c:2597
 get_page_from_freelist+0x27ea/0x2870 mm/page_alloc.c:4425
 __alloc_pages+0x3a1/0x780 mm/page_alloc.c:5712
 alloc_slab_page+0x6c/0xf0
 allocate_slab mm/slub.c:1962 [inline]
 new_slab+0x90/0x3e0 mm/slub.c:2015
 ___slab_alloc+0x6f9/0xb80 mm/slub.c:3203
 __slab_alloc+0x5d/0xa0 mm/slub.c:3302
 slab_alloc_node mm/slub.c:3387 [inline]
 __kmem_cache_alloc_node+0x1af/0x250 mm/slub.c:3460
 __do_kmalloc_node mm/slab_common.c:956 [inline]
 __kmalloc+0xa3/0x1e0 mm/slab_common.c:970
 kmalloc include/linux/slab.h:558 [inline]
 kzalloc include/linux/slab.h:689 [inline]
 acpi_os_allocate_zeroed include/acpi/platform/aclinuxex.h:57 [inline]
 acpi_ut_execute_UID+0x1b5/0x3f0 drivers/acpi/acpica/utids.c:141
 acpi_get_object_info+0x3b3/0x1060 drivers/acpi/acpica/nsxfname.c:296
 acpi_set_pnp_ids drivers/acpi/scan.c:1342 [inline]
 acpi_init_device_object+0x609/0x34f0 drivers/acpi/scan.c:1778
 acpi_add_single_object+0x105/0x1be0 drivers/acpi/scan.c:1828
 acpi_bus_check_add+0x404/0x970 drivers/acpi/scan.c:2088
 acpi_bus_check_add_1+0x22/0x30 drivers/acpi/scan.c:2104
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888109c91d80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff888109c91e00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff888109c91e80: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
                                              ^
 ffff888109c91f00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff888109c91f80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================
EXT4-fs error (device loop0): ext4_inlinedir_to_tree:1432: inode #12: block 7: comm syz-executor357: path /root/syzkaller.fbenI3/0/file0/file0: bad entry in directory: directory entry overrun - offset=34816, inode=2538880996, rec_len=34812, size=128 fake=0
EXT4-fs error (device loop0): empty_inline_dir:1858: inode #12: block 7: comm syz-executor357: bad entry in directory: directory entry overrun - offset=4, inode=2538880996, rec_len=34812, size=60 fake=0
EXT4-fs warning (device loop0): empty_inline_dir:1865: bad inline directory (dir #12) - inode 2538880996, rec_len 34812, name_len 234inline size 60
EXT4-fs error (device loop0): ext4_inlinedir_to_tree:1432: inode #12: block 7: comm syz-executor357: path /root/syzkaller.fbenI3/0/file0/file0: bad entry in directory: directory entry overrun - offset=34816, inode=2538880996, rec_len=34812, size=128 fake=0
EXT4-fs error (device loop0): empty_inline_dir:1858: inode #12: block 7: comm syz-executor357: bad entry in directory: directory entry overrun - offset=4, inode=2538880996, rec_len=34812, size=60 fake=0
EXT4-fs warning (device loop0): empty_inline_dir:1865: bad inline directory (dir #12) - inode 2538880996, rec_len 34812, name_len 234inline size 60
EXT4-fs error (device loop0): ext4_inlinedir_to_tree:1432: inode #12: block 7: comm syz-executor357: path /root/syzkaller.fbenI3/0/file0/file0: bad entry in directory: directory entry overrun - offset=34816, inode=2538880996, rec_len=34812, size=128 fake=0
EXT4-fs error (device loop0): empty_inline_dir:1858: inode #12: block 7: comm syz-executor357: bad entry in directory: directory entry overrun - offset=4, inode=2538880996, rec_len=34812, size=60 fake=0
EXT4-fs warning (device loop0): empty_inline_dir:1865: bad inline directory (dir #12) - inode 2538880996, rec_len 34812, name_len 234inline size 60
EXT4-fs error (device loop0): ext4_inlinedir_to_tree:1432: inode #12: block 7: comm syz-executor357: path /root/syzkaller.fbenI3/0/file0/file0: bad entry in directory: directory entry overrun - offset=34816, inode=2538880996, rec_len=34812, size=128 fake=0
EXT4-fs error (device loop0): empty_inline_dir:1858: inode #12: block 7: comm syz-executor357: bad entry in directory: directory entry overrun - offset=4, inode=2538880996, rec_len=34812, size=60 fake=0
EXT4-fs warning (device loop0): empty_inline_dir:1865: bad inline directory (dir #12) - inode 2538880996, rec_len 34812, name_len 234inline size 60
EXT4-fs error (device loop0): ext4_inlinedir_to_tree:1432: inode #12: block 7: comm syz-executor357: path /root/syzkaller.fbenI3/0/file0/file0: bad entry in directory: directory entry overrun - offset=34816, inode=2538880996, rec_len=34812, size=128 fake=0
EXT4-fs error (device loop0): empty_inline_dir:1858: inode #12: block 7: comm syz-executor357: bad entry in directory: directory entry overrun - offset=4, inode=2538880996, rec_len=34812, size=60 fake=0
EXT4-fs warning (device loop0): empty_inline_dir:1865: bad inline directory (dir #12) - inode 2538880996, rec_len 34812, name_len 234inline size 60
EXT4-fs warning (device loop0): empty_inline_dir:1865: bad inline directory (dir #12) - inode 2538880996, rec_len 34812, name_len 234inline size 60
EXT4-fs warning (device loop0): empty_inline_dir:1865: bad inline directory (dir #12) - inode 2538880996, rec_len 34812, name_len 234inline size 60
EXT4-fs warning (device loop0): empty_inline_dir:1865: bad inline directory (dir #12) - inode 2538880996, rec_len 34812, name_len 234inline size 60
EXT4-fs warning (device loop0): empty_inline_dir:1865: bad inline directory (dir #12) - inode 2538880996, rec_len 34812, name_len 234inline size 60
EXT4-fs warning (device loop0): empty_inline_dir:1865: bad inline directory (dir #12) - inode 2538880996, rec_len 34812, name_len 234inline size 60

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/14 08:34 android14-6.1 cfa154389a65 c8349e48 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-android-6-1 KASAN: slab-out-of-bounds Read in ext4_inlinedir_to_tree
* Struck through repros no longer work on HEAD.