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

10 views
Skip to first unread message

syzbot

unread,
Nov 26, 2022, 5:26:43 AM11/26/22
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 3f8a27f9e27b Linux 4.19.211
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=165aa755880000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=9b41ed445bcf0d9efcd6
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=156b71c3880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16a0d0ad880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/98c0bdb4abb3/disk-3f8a27f9.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ea228ff02669/vmlinux-3f8a27f9.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/a461a2bc3ca8/mount_0.gz

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

hfsplus: request for non-existent node 184549376 in B*Tree
hfsplus: request for non-existent node 184549376 in B*Tree
==================================================================
BUG: KASAN: slab-out-of-bounds in hfsplus_bnode_read+0x19b/0x1b0 fs/hfsplus/bnode.c:32
Read of size 8 at addr ffff8880abfd46b8 by task syz-executor141/8110

CPU: 0 PID: 8110 Comm: syz-executor141 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
kasan_report mm/kasan/report.c:412 [inline]
__asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433
hfsplus_bnode_read+0x19b/0x1b0 fs/hfsplus/bnode.c:32
hfsplus_bnode_read_u16 fs/hfsplus/bnode.c:47 [inline]
hfsplus_bnode_dump+0x2c2/0x3a0 fs/hfsplus/bnode.c:328
hfsplus_brec_remove+0x3d7/0x4e0 fs/hfsplus/brec.c:229
__hfsplus_delete_attr+0x217/0x370 fs/hfsplus/attributes.c:299
hfsplus_delete_all_attrs+0x149/0x3f0 fs/hfsplus/attributes.c:378
hfsplus_delete_cat+0x824/0xe30 fs/hfsplus/catalog.c:425
hfsplus_unlink+0x1d2/0x820 fs/hfsplus/dir.c:385
vfs_unlink+0x27d/0x4e0 fs/namei.c:4002
do_unlinkat+0x3b8/0x660 fs/namei.c:4065
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f827d65d779
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:00007fff50902a48 EFLAGS: 00000246 ORIG_RAX: 0000000000000057
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f827d65d779
RDX: 00007f827d61bdf3 RSI: 0000000000000000 RDI: 0000000020000140
RBP: 00007f827d61d010 R08: 00000000000005f0 R09: 0000000000000000
R10: 00007fff50902910 R11: 0000000000000246 R12: 00007f827d61d0a0
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 8110:
__do_kmalloc mm/slab.c:3727 [inline]
__kmalloc+0x15a/0x3c0 mm/slab.c:3736
kmalloc include/linux/slab.h:520 [inline]
kzalloc include/linux/slab.h:709 [inline]
__hfs_bnode_create+0x105/0xb60 fs/hfsplus/bnode.c:416
hfsplus_bnode_find+0x2aa/0xb80 fs/hfsplus/bnode.c:497
hfsplus_brec_find+0x2af/0x500 fs/hfsplus/bfind.c:183
hfsplus_find_attr fs/hfsplus/attributes.c:160 [inline]
hfsplus_delete_all_attrs+0x2dd/0x3f0 fs/hfsplus/attributes.c:371
hfsplus_delete_cat+0x824/0xe30 fs/hfsplus/catalog.c:425
hfsplus_unlink+0x1d2/0x820 fs/hfsplus/dir.c:385
vfs_unlink+0x27d/0x4e0 fs/namei.c:4002
do_unlinkat+0x3b8/0x660 fs/namei.c:4065
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 6247:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
kvfree+0x59/0x60 mm/util.c:452
getxattr+0x1c7/0x2b0 fs/xattr.c:620
path_getxattr+0xb6/0x150 fs/xattr.c:635
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880abfd4600
which belongs to the cache kmalloc-192 of size 192
The buggy address is located 184 bytes inside of
192-byte region [ffff8880abfd4600, ffff8880abfd46c0)
The buggy address belongs to the page:
page:ffffea0002aff500 count:1 mapcount:0 mapping:ffff88813bff0040 index:0xffff8880abfd4e00
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea0002d6ea88 ffffea0002d4b188 ffff88813bff0040
raw: ffff8880abfd4e00 ffff8880abfd4000 000000010000000c 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880abfd4580: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff8880abfd4600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880abfd4680: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff8880abfd4700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880abfd4780: fb fb fb fb fb fb fb fb 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.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Dec 3, 2022, 12:45:41 AM12/3/22
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 179ef7fe8677 Linux 4.14.300
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=142cd229880000
kernel config: https://syzkaller.appspot.com/x/.config?x=aa85f51ec321d5a9
dashboard link: https://syzkaller.appspot.com/bug?extid=cd6cdb4dfa56c70a38dd
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15ef2e47880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12142247880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/d311ef57b59a/disk-179ef7fe.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/25bf5d729f69/vmlinux-179ef7fe.xz
kernel image: https://storage.googleapis.com/syzbot-assets/db9b96571e69/bzImage-179ef7fe.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/6efd3e043f5f/mount_0.gz

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

hfsplus: request for non-existent node 184549376 in B*Tree
hfsplus: request for non-existent node 184549376 in B*Tree
==================================================================
BUG: KASAN: slab-out-of-bounds in hfsplus_bnode_read+0x18c/0x1a0 fs/hfsplus/bnode.c:32
Read of size 8 at addr ffff8880ac250fb8 by task syz-executor155/7946

CPU: 1 PID: 7946 Comm: syz-executor155 Not tainted 4.14.300-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x281 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
kasan_report mm/kasan/report.c:409 [inline]
__asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:430
hfsplus_bnode_read+0x18c/0x1a0 fs/hfsplus/bnode.c:32
hfsplus_bnode_read_u16 fs/hfsplus/bnode.c:47 [inline]
hfsplus_bnode_dump+0x255/0x310 fs/hfsplus/bnode.c:330
hfsplus_brec_remove+0x384/0x480 fs/hfsplus/brec.c:228
__hfsplus_delete_attr+0x1eb/0x310 fs/hfsplus/attributes.c:299
hfsplus_delete_all_attrs+0x12c/0x3a0 fs/hfsplus/attributes.c:378
hfsplus_delete_cat+0x765/0xd70 fs/hfsplus/catalog.c:425
hfsplus_unlink+0x1d6/0x6b0 fs/hfsplus/dir.c:387
vfs_unlink+0x230/0x470 fs/namei.c:4029
do_unlinkat+0x30c/0x5c0 fs/namei.c:4094
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x5e/0xd3

Allocated by task 7946:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
__do_kmalloc mm/slab.c:3720 [inline]
__kmalloc+0x15a/0x400 mm/slab.c:3729
kmalloc include/linux/slab.h:493 [inline]
kzalloc include/linux/slab.h:661 [inline]
__hfs_bnode_create+0xe7/0x950 fs/hfsplus/bnode.c:420
hfsplus_bnode_find+0x2cb/0x9e0 fs/hfsplus/bnode.c:501
hfsplus_brec_find+0x265/0x460 fs/hfsplus/bfind.c:183
hfsplus_find_attr fs/hfsplus/attributes.c:160 [inline]
hfsplus_delete_all_attrs+0x2b6/0x3a0 fs/hfsplus/attributes.c:371
hfsplus_delete_cat+0x765/0xd70 fs/hfsplus/catalog.c:425
hfsplus_unlink+0x1d6/0x6b0 fs/hfsplus/dir.c:387
vfs_unlink+0x230/0x470 fs/namei.c:4029
do_unlinkat+0x30c/0x5c0 fs/namei.c:4094
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x5e/0xd3

Freed by task 1:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xc9/0x250 mm/slab.c:3815
kernfs_release_file+0xcc/0x160 fs/kernfs/file.c:764
kernfs_fop_release+0x136/0x180 fs/kernfs/file.c:776
__fput+0x25f/0x7a0 fs/file_table.c:210
task_work_run+0x11f/0x190 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:191 [inline]
exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164
prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
entry_SYSCALL_64_after_hwframe+0x5e/0xd3

The buggy address belongs to the object at ffff8880ac250f00
which belongs to the cache kmalloc-192 of size 192
The buggy address is located 184 bytes inside of
192-byte region [ffff8880ac250f00, ffff8880ac250fc0)
The buggy address belongs to the page:
page:ffffea0002b09400 count:1 mapcount:0 mapping:ffff8880ac250000 index:0xffff8880ac250900
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880ac250000 ffff8880ac250900 0000000100000009
raw: ffff88813fe64138 ffffea0002b1ca20 ffff88813fe74040 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880ac250e80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff8880ac250f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880ac250f80: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff8880ac251000: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fb fb
ffff8880ac251080: fb fb fb fb fb fb fb fb fc fc fc fc fb fb fb fb
Reply all
Reply to author
Forward
0 new messages