syzbot
KASAN: slab-out-of-bounds Read in ext4_htree_fill_tree
Status:
upstream: reported C repro on 2024/07/21 20:19
Reported-by: syzbot+ed1375847e58c67f38b8@syzkaller.appspotmail.com
First crash: 758d, last: 2d01h
▶
▼
Last patch testing requests (10)
▶
▼
Fix bisection attempts (3)
Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in ext4_htree_fill_tree+0x1080/0x10e0 fs/ext4/namei.c:1221
Read of size 1 at addr ffff88810fdedf7a by task syz-executor/365
CPU: 1 PID: 365 Comm: syz-executor Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Call Trace:
__dump_stack+0x21/0x24 lib/dump_stack.c:77
dump_stack_lvl+0x1a7/0x208 lib/dump_stack.c:118
print_address_description+0x7f/0x2c0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:435 [inline]
kasan_report+0x100/0x140 mm/kasan/report.c:452
__asan_report_load1_noabort+0x14/0x20 mm/kasan/report_generic.c:306
ext4_htree_fill_tree+0x1080/0x10e0 fs/ext4/namei.c:1221
ext4_dx_readdir fs/ext4/dir.c:601 [inline]
ext4_readdir+0x2bcf/0x3a80 fs/ext4/dir.c:145
iterate_dir+0x25c/0x560 fs/readdir.c:-1
__do_sys_getdents64 fs/readdir.c:369 [inline]
__se_sys_getdents64+0xf2/0x250 fs/readdir.c:354
__x64_sys_getdents64+0x7b/0x90 fs/readdir.c:354
do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f711c839a73
Code: c7 c0 e8 ff ff ff 64 c7 00 16 00 00 00 31 c0 eb 9e e8 81 9b fd ff 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 e8 ff ff ff f7 d8
RSP: 002b:00007ffdd2ef67e8 EFLAGS: 00000293 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 0000555573d7b910 RCX: 00007f711c839a73
RDX: 0000000000008000 RSI: 0000555573d7b940 RDI: 0000000000000005
RBP: 0000555573d7b940 R08: 0000000000028701 R09: 0000000000000001
R10: 00007f711ca65e20 R11: 0000000000000293 R12: 0000555573d7b914
R13: ffffffffffffffe8 R14: 0000000000000010 R15: 00007ffdd2ef8a90
Allocated by task 365:
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:430 [inline]
____kasan_kmalloc mm/kasan/common.c:509 [inline]
__kasan_kmalloc+0xd4/0x100 mm/kasan/common.c:518
kasan_kmalloc include/linux/kasan.h:254 [inline]
__kmalloc+0x19f/0x330 mm/slub.c:4038
kmalloc include/linux/slab.h:560 [inline]
kzalloc include/linux/slab.h:667 [inline]
fib_create_info+0x8eb/0x1ed0 net/ipv4/fib_semantics.c:1477
fib_table_insert+0xc2/0x1d50 net/ipv4/fib_trie.c:1170
fib_magic net/ipv4/fib_frontend.c:1107 [inline]
fib_add_ifaddr+0x360/0xf90 net/ipv4/fib_frontend.c:1129
fib_inetaddr_event+0x15d/0x310 net/ipv4/fib_frontend.c:1445
notifier_call_chain kernel/notifier.c:83 [inline]
blocking_notifier_call_chain+0xba/0x140 kernel/notifier.c:337
__inet_insert_ifa+0x88e/0xa80 net/ipv4/devinet.c:567
inet_rtm_newaddr+0x8cf/0x1580 net/ipv4/devinet.c:967
rtnetlink_rcv_msg+0x9e9/0xca0 net/core/rtnetlink.c:5622
netlink_rcv_skb+0x1e9/0x430 net/netlink/af_netlink.c:2508
rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5640
netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline]
netlink_unicast+0x86c/0xa30 net/netlink/af_netlink.c:1340
netlink_sendmsg+0x949/0xb70 net/netlink/af_netlink.c:1919
sock_sendmsg_nosec net/socket.c:652 [inline]
__sock_sendmsg net/socket.c:664 [inline]
__sys_sendto+0x467/0x620 net/socket.c:2007
__do_sys_sendto net/socket.c:2019 [inline]
__se_sys_sendto net/socket.c:2015 [inline]
__x64_sys_sendto+0xe5/0x100 net/socket.c:2015
do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x61/0xcb
The buggy address belongs to the object at ffff88810fdede00
which belongs to the cache kmalloc-256 of size 256
The buggy address is located 122 bytes to the right of
256-byte region [ffff88810fdede00, ffff88810fdedf00)
The buggy address belongs to the page:
page:ffffea00043f7b00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10fdec
head:ffffea00043f7b00 order:1 compound_mapcount:0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 ffffea00043f4480 0000000900000009 ffff888100043200
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 96, ts 4001502013, free_ts 0
set_page_owner include/linux/page_owner.h:35 [inline]
post_alloc_hook mm/page_alloc.c:2456 [inline]
prep_new_page+0x176/0x190 mm/page_alloc.c:2462
get_page_from_freelist+0x225f/0x23f0 mm/page_alloc.c:4254
__alloc_pages_nodemask+0x29a/0x640 mm/page_alloc.c:5384
alloc_slab_page mm/slub.c:-1 [inline]
allocate_slab mm/slub.c:1813 [inline]
new_slab+0x84/0x3f0 mm/slub.c:1874
new_slab_objects mm/slub.c:2632 [inline]
___slab_alloc+0x2f8/0x4c0 mm/slub.c:2796
__slab_alloc+0x63/0xa0 mm/slub.c:2836
slab_alloc_node mm/slub.c:2918 [inline]
slab_alloc mm/slub.c:2960 [inline]
kmem_cache_alloc_trace+0x1a8/0x2e0 mm/slub.c:2977
kmalloc include/linux/slab.h:555 [inline]
inode_doinit_use_xattr+0x5d/0x400 security/selinux/hooks.c:1345
inode_doinit_with_dentry+0x93a/0xd70 security/selinux/hooks.c:1538
selinux_d_instantiate+0x27/0x40 security/selinux/hooks.c:6395
security_d_instantiate+0x9e/0xf0 security/security.c:1980
d_splice_alias+0x6d/0x390 fs/dcache.c:3038
kernfs_iop_lookup+0x2c5/0x310 fs/kernfs/dir.c:1178
lookup_open fs/namei.c:3234 [inline]
open_last_lookups fs/namei.c:3325 [inline]
path_openat+0x145d/0x3040 fs/namei.c:3514
do_filp_open+0x1df/0x400 fs/namei.c:3544
do_sys_openat2+0x19f/0x750 fs/open.c:1219
page_owner free stack trace missing
Memory state around the buggy address:
ffff88810fdede00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88810fdede80: 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc
>ffff88810fdedf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff88810fdedf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88810fdee000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
EXT4-fs error (device loop2): htree_dirblock_to_tree:1092: inode #2: block 33: comm syz-executor: bad entry in directory: inode out of bounds - offset=2012, inode=128, rec_len=36, size=1024 fake=1
* Struck through repros no longer work on HEAD.