[v5.15] KASAN: slab-out-of-bounds Read in hfsplus_bnode_read

0 views
Skip to first unread message

syzbot

unread,
Jun 20, 2023, 4:03:04 PM6/20/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 471e639e59d1 Linux 5.15.117
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1736ec7b280000
kernel config: https://syzkaller.appspot.com/x/.config?x=6390289bcc1381aa
dashboard link: https://syzkaller.appspot.com/bug?extid=eb480a97eb5b35890f06
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=156942db280000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=175d5fa7280000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/145b7f137d72/disk-471e639e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/b5bd2fcb945c/vmlinux-471e639e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/794584032e0f/bzImage-471e639e.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/346ef14222ab/mount_0.gz

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

loop0: detected capacity change from 0 to 1024
hfsplus: request for non-existent node 32768 in B*Tree
hfsplus: request for non-existent node 32768 in B*Tree
==================================================================
BUG: KASAN: slab-out-of-bounds in hfsplus_bnode_read+0x85/0x1c0 fs/hfsplus/bnode.c:32
Read of size 8 at addr ffff88802416f4c0 by task syz-executor352/3498

CPU: 1 PID: 3498 Comm: syz-executor352 Not tainted 5.15.117-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_address_description+0x63/0x3b0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
hfsplus_bnode_read+0x85/0x1c0 fs/hfsplus/bnode.c:32
hfsplus_bnode_read_u16 fs/hfsplus/bnode.c:47 [inline]
hfsplus_bnode_dump+0x3f7/0x7c0 fs/hfsplus/bnode.c:328
hfsplus_brec_remove+0x428/0x4e0 fs/hfsplus/brec.c:229
__hfsplus_delete_attr+0x271/0x450 fs/hfsplus/attributes.c:299
hfsplus_delete_all_attrs+0x267/0x3c0 fs/hfsplus/attributes.c:378
hfsplus_delete_cat+0xb83/0xfb0 fs/hfsplus/catalog.c:425
hfsplus_unlink+0x35f/0x7f0 fs/hfsplus/dir.c:385
vfs_unlink+0x359/0x5f0 fs/namei.c:4209
do_unlinkat+0x49d/0x940 fs/namei.c:4277
__do_sys_unlink fs/namei.c:4325 [inline]
__se_sys_unlink fs/namei.c:4323 [inline]
__x64_sys_unlink+0x45/0x50 fs/namei.c:4323
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7fcd51cce799
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 14 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff190afa88 EFLAGS: 00000246 ORIG_RAX: 0000000000000057
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fcd51cce799
RDX: 00007fcd51c8ce13 RSI: 0000000000000000 RDI: 0000000020000140
RBP: 00007fcd51c8e030 R08: 0000000000000640 R09: 0000000000000000
R10: 00007fff190af950 R11: 0000000000000246 R12: 00007fcd51c8e0c0
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
</TASK>

Allocated by task 3498:
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+0xba/0xf0 mm/kasan/common.c:513
kasan_kmalloc include/linux/kasan.h:264 [inline]
__kmalloc+0x168/0x300 mm/slub.c:4407
kmalloc include/linux/slab.h:596 [inline]
kzalloc include/linux/slab.h:721 [inline]
__hfs_bnode_create+0xf9/0xbb0 fs/hfsplus/bnode.c:416
hfsplus_bnode_find+0x22e/0xe80 fs/hfsplus/bnode.c:497
hfsplus_brec_find+0x17f/0x570 fs/hfsplus/bfind.c:183
hfsplus_find_attr fs/hfsplus/attributes.c:160 [inline]
hfsplus_delete_all_attrs+0x23e/0x3c0 fs/hfsplus/attributes.c:371
hfsplus_delete_cat+0xb83/0xfb0 fs/hfsplus/catalog.c:425
hfsplus_unlink+0x35f/0x7f0 fs/hfsplus/dir.c:385
vfs_unlink+0x359/0x5f0 fs/namei.c:4209
do_unlinkat+0x49d/0x940 fs/namei.c:4277
__do_sys_unlink fs/namei.c:4325 [inline]
__se_sys_unlink fs/namei.c:4323 [inline]
__x64_sys_unlink+0x45/0x50 fs/namei.c:4323
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb

Last potentially related work creation:
kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
insert_work+0x54/0x3e0 kernel/workqueue.c:1363
__queue_work+0x963/0xd00 kernel/workqueue.c:1529
queue_work_on+0x14b/0x250 kernel/workqueue.c:1556
queue_work include/linux/workqueue.h:502 [inline]
call_usermodehelper_exec+0x269/0x450 kernel/umh.c:435
kobject_uevent_env+0x69e/0x8d0 lib/kobject_uevent.c:618
rx_queue_add_kobject net/core/net-sysfs.c:1070 [inline]
net_rx_queue_update_kobjects+0x215/0x470 net/core/net-sysfs.c:1110
register_queue_kobjects net/core/net-sysfs.c:1767 [inline]
netdev_register_kobject+0x222/0x310 net/core/net-sysfs.c:2018
register_netdevice+0x1067/0x1700 net/core/dev.c:10331
register_netdev+0x37/0x50 net/core/dev.c:10455
rose_proto_init+0x19c/0x7b6 net/rose/af_rose.c:1545
do_one_initcall+0x22b/0x7a0 init/main.c:1306
do_initcall_level+0x157/0x207 init/main.c:1379
do_initcalls+0x49/0x86 init/main.c:1395
kernel_init_freeable+0x43c/0x5c5 init/main.c:1619
kernel_init+0x19/0x290 init/main.c:1510
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

The buggy address belongs to the object at ffff88802416f400
which belongs to the cache kmalloc-192 of size 192
The buggy address is located 0 bytes to the right of
192-byte region [ffff88802416f400, ffff88802416f4c0)
The buggy address belongs to the page:
page:ffffea0000905bc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2416f
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea00008d9780 0000000300000003 ffff888011c41a00
raw: 0000000000000000 0000000080100010 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, ts 14459726568, free_ts 0
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
__alloc_pages+0x272/0x700 mm/page_alloc.c:5421
alloc_page_interleave+0x22/0x1c0 mm/mempolicy.c:2031
alloc_slab_page mm/slub.c:1775 [inline]
allocate_slab mm/slub.c:1912 [inline]
new_slab+0xbb/0x4b0 mm/slub.c:1975
___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
__slab_alloc mm/slub.c:3095 [inline]
slab_alloc_node mm/slub.c:3186 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc_trace+0x1a0/0x290 mm/slub.c:3245
kmalloc include/linux/slab.h:591 [inline]
kzalloc include/linux/slab.h:721 [inline]
call_usermodehelper_setup+0x8a/0x260 kernel/umh.c:365
kobject_uevent_env+0x681/0x8d0 lib/kobject_uevent.c:614
netdev_queue_add_kobject net/core/net-sysfs.c:1677 [inline]
netdev_queue_update_kobjects+0x1c1/0x3f0 net/core/net-sysfs.c:1711
register_queue_kobjects net/core/net-sysfs.c:1772 [inline]
netdev_register_kobject+0x263/0x310 net/core/net-sysfs.c:2018
register_netdevice+0x1067/0x1700 net/core/dev.c:10331
register_netdev+0x37/0x50 net/core/dev.c:10455
rose_proto_init+0x19c/0x7b6 net/rose/af_rose.c:1545
do_one_initcall+0x22b/0x7a0 init/main.c:1306
do_initcall_level+0x157/0x207 init/main.c:1379
do_initcalls+0x49/0x86 init/main.c:1395
page_owner free stack trace missing

Memory state around the buggy address:
ffff88802416f380: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88802416f400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88802416f480: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff88802416f500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88802416f580: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
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