[Android 5.4] KASAN: slab-out-of-bounds Read in ext4_inlinedir_to_tree

1 view
Skip to first unread message

syzbot

unread,
Apr 13, 2024, 11:10:34 PMApr 13
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: d0d34dcb02cc FROMLIST: binder: check offset alignment in b..
git tree: android12-5.4
console+strace: https://syzkaller.appspot.com/x/log.txt?x=17cf1b6d180000
kernel config: https://syzkaller.appspot.com/x/.config?x=60c0e8be982a03fd
dashboard link: https://syzkaller.appspot.com/bug?extid=c15764b4e3c4b99dae18
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16590feb180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=148c4263180000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/de032a90cf4e/disk-d0d34dcb.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/f2bae6132625/vmlinux-d0d34dcb.xz
kernel image: https://storage.googleapis.com/syzbot-assets/2c3043eb62d8/bzImage-d0d34dcb.xz
mounted in repro #1: https://storage.googleapis.com/syzbot-assets/17325fc56081/mount_0.gz
mounted in repro #2: https://storage.googleapis.com/syzbot-assets/6ea98ed53fdc/mount_7.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+c15764...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: slab-out-of-bounds in ext4_read_inline_data fs/ext4/inline.c:209 [inline]
BUG: KASAN: slab-out-of-bounds in ext4_inlinedir_to_tree+0x555/0x1160 fs/ext4/inline.c:1399
Read of size 68 at addr ffff8881dbfceec9 by task syz-executor200/356

CPU: 0 PID: 356 Comm: syz-executor200 Not tainted 5.4.268-syzkaller-00012-gd0d34dcb02cc #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1d8/0x241 lib/dump_stack.c:118
print_address_description+0x8c/0x600 mm/kasan/report.c:384
__kasan_report+0xf3/0x120 mm/kasan/report.c:516
kasan_report+0x30/0x60 mm/kasan/common.c:653
check_memory_region_inline mm/kasan/generic.c:141 [inline]
check_memory_region+0x272/0x280 mm/kasan/generic.c:191
memcpy+0x25/0x50 mm/kasan/common.c:123
ext4_read_inline_data fs/ext4/inline.c:209 [inline]
ext4_inlinedir_to_tree+0x555/0x1160 fs/ext4/inline.c:1399
ext4_htree_fill_tree+0x5b2/0x1770 fs/ext4/namei.c:1174
ext4_dx_readdir fs/ext4/dir.c:599 [inline]
ext4_readdir+0x2c1d/0x3610 fs/ext4/dir.c:142
iterate_dir+0x266/0x4e0 fs/readdir.c:64
ksys_getdents64+0x21b/0x4c0 fs/readdir.c:374
__do_sys_getdents64 fs/readdir.c:395 [inline]
__se_sys_getdents64 fs/readdir.c:392 [inline]
__x64_sys_getdents64+0x76/0x80 fs/readdir.c:392
do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1

Allocated by task 0:
(stack is not available)

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff8881dbfceea0
which belongs to the cache file_lock_cache of size 248
The buggy address is located 41 bytes inside of
248-byte region [ffff8881dbfceea0, ffff8881dbfcef98)
The buggy address belongs to the page:
page:ffffea00076ff380 refcount:1 mapcount:0 mapping:ffff8881f1dcc780 index:0x0
flags: 0x8000000000000200(slab)
raw: 8000000000000200 dead000000000100 dead000000000122 ffff8881f1dcc780
raw: 0000000000000000 00000000800d000d 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)
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook mm/page_alloc.c:2165 [inline]
prep_new_page+0x18f/0x370 mm/page_alloc.c:2171
get_page_from_freelist+0x2d13/0x2d90 mm/page_alloc.c:3794
__alloc_pages_nodemask+0x393/0x840 mm/page_alloc.c:4891
alloc_slab_page+0x39/0x3c0 mm/slub.c:343
allocate_slab mm/slub.c:1683 [inline]
new_slab+0x97/0x440 mm/slub.c:1749
new_slab_objects mm/slub.c:2505 [inline]
___slab_alloc+0x2fe/0x490 mm/slub.c:2667
__slab_alloc+0x62/0xa0 mm/slub.c:2707
slab_alloc_node mm/slub.c:2792 [inline]
slab_alloc mm/slub.c:2837 [inline]
kmem_cache_alloc+0x109/0x250 mm/slub.c:2842
kmem_cache_zalloc include/linux/slab.h:680 [inline]
locks_alloc_lock fs/locks.c:346 [inline]
flock_lock_inode+0x342/0x1460 fs/locks.c:1076
flock_lock_inode_wait fs/locks.c:2162 [inline]
locks_lock_inode_wait+0xee/0x3f0 fs/locks.c:2189
locks_lock_file_wait include/linux/fs.h:1375 [inline]
__do_sys_flock fs/locks.c:2252 [inline]
__se_sys_flock+0x47b/0x5a0 fs/locks.c:2215
do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1
page_owner free stack trace missing

Memory state around the buggy address:
ffff8881dbfced80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8881dbfcee00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881dbfcee80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff8881dbfcef00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8881dbfcef80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
EXT4-fs error (device loop0): ext4_inlinedir_to_tree:1437: inode #12: block 7: comm syz-executor200: path /root/syzkaller.zUnyci/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:1832: inode #12: block 7: comm syz-executor200: bad entry in directory: directory entry overrun - off


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Apr 14, 2024, 4:35:28 AMApr 14
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: cfa154389a65 ANDROID: GKI: Update honda symbol list for as..
git tree: android14-6.1
console+strace: https://syzkaller.appspot.com/x/log.txt?x=1244d8b3180000
kernel config: https://syzkaller.appspot.com/x/.config?x=7bd1a415c6de5d9d
dashboard link: https://syzkaller.appspot.com/bug?extid=1d1e7860ae72567466db
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14643cdd180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13d5302b180000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/d6a11e5cb459/disk-cfa15438.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/06eb37a4b847/vmlinux-cfa15438.xz
kernel image: https://storage.googleapis.com/syzbot-assets/fccedd9bdbca/bzImage-cfa15438.xz
mounted in repro #1: https://storage.googleapis.com/syzbot-assets/6a0a4d785df3/mount_0.gz
mounted in repro #2: https://storage.googleapis.com/syzbot-assets/bdb4e1b56d9c/mount_7.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+1d1e78...@syzkaller.appspotmail.com

==================================================================
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
Reply all
Reply to author
Forward
0 new messages