[v5.15] KASAN: slab-out-of-bounds Write in hfs_bnode_read

0 views
Skip to first unread message

syzbot

unread,
Jun 4, 2023, 3:50:11 PM6/4/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 0ab06468cbd1 Linux 5.15.114
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14d0a5a5280000
kernel config: https://syzkaller.appspot.com/x/.config?x=9a2696a271d0eba
dashboard link: https://syzkaller.appspot.com/bug?extid=7c622e858e9150895fda
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12c221a3280000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15bd0e7d280000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/8ff3613d3f6b/disk-0ab06468.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/eebe2d8c6813/vmlinux-0ab06468.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f30284c26197/Image-0ab06468.gz.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/63bcdec7619b/mount_0.gz

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

loop0: detected capacity change from 0 to 64
hfs: unable to locate alternate MDB
hfs: continuing without an alternate MDB
==================================================================
BUG: KASAN: slab-out-of-bounds in hfs_bnode_read+0x1b4/0x2dc fs/hfs/bnode.c:37
Write of size 256 at addr ffff0000cfc35700 by task syz-executor583/3959

CPU: 1 PID: 3959 Comm: syz-executor583 Not tainted 5.15.114-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023
Call trace:
dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
print_address_description+0x7c/0x3f0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x174/0x1e4 mm/kasan/report.c:451
kasan_check_range+0x274/0x2b4 mm/kasan/generic.c:189
memcpy+0xb4/0xe8 mm/kasan/shadow.c:66
hfs_bnode_read+0x1b4/0x2dc fs/hfs/bnode.c:37
hfs_bnode_read_key+0x154/0x21c fs/hfs/bnode.c:73
hfs_brec_insert+0x508/0x97c fs/hfs/brec.c:141
hfs_cat_create+0x4f0/0x844 fs/hfs/catalog.c:131
hfs_create+0x70/0xe4 fs/hfs/dir.c:202
lookup_open fs/namei.c:3392 [inline]
open_last_lookups fs/namei.c:3462 [inline]
path_openat+0xec0/0x26f0 fs/namei.c:3669
do_filp_open+0x1a8/0x3b4 fs/namei.c:3699
do_sys_openat2+0x128/0x3d8 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]
__arm64_sys_openat+0x1f0/0x240 fs/open.c:1238
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Allocated by task 3959:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
____kasan_kmalloc+0xbc/0xfc mm/kasan/common.c:513
__kasan_kmalloc+0x10/0x1c mm/kasan/common.c:522
kasan_kmalloc include/linux/kasan.h:264 [inline]
__kmalloc+0x29c/0x4c8 mm/slub.c:4407
kmalloc include/linux/slab.h:596 [inline]
hfs_find_init+0x88/0x1c8 fs/hfs/bfind.c:21
hfs_cat_create+0x168/0x844 fs/hfs/catalog.c:96
hfs_create+0x70/0xe4 fs/hfs/dir.c:202
lookup_open fs/namei.c:3392 [inline]
open_last_lookups fs/namei.c:3462 [inline]
path_openat+0xec0/0x26f0 fs/namei.c:3669
do_filp_open+0x1a8/0x3b4 fs/namei.c:3699
do_sys_openat2+0x128/0x3d8 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]
__arm64_sys_openat+0x1f0/0x240 fs/open.c:1238
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

The buggy address belongs to the object at ffff0000cfc35700
which belongs to the cache kmalloc-128 of size 128
The buggy address is located 0 bytes inside of
128-byte region [ffff0000cfc35700, ffff0000cfc35780)
The buggy address belongs to the page:
page:000000006bed105e refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10fc35
flags: 0x5ffc00000000200(slab|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000000200 fffffc00033f0dc0 0000000300000003 ffff0000c0002300
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff0000cfc35600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000cfc35680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000cfc35700: 00 00 00 00 00 00 00 00 00 06 fc fc fc fc fc fc
^
ffff0000cfc35780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff0000cfc35800: fb fb fb fb fb fb fb fb fb fb


---
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 bug is already fixed, 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 change bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

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

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages