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

6 views
Skip to first unread message

syzbot

unread,
Dec 1, 2022, 10:19:41 PM12/1/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=1162cf4b880000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=19f4755b8713c0c94299
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11139cf5880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11b0c55b880000

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/9e783f9c73e0/mount_0.gz

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

IPVS: ftp: loaded support on port[0] = 21
==================================================================
BUG: KASAN: slab-out-of-bounds in hfs_strcmp+0x143/0x170 fs/hfs/string.c:84
Read of size 1 at addr ffff8880b2f4a5ce by task kworker/u4:0/7

CPU: 0 PID: 7 Comm: kworker/u4:0 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Workqueue: writeback wb_workfn (flush-7:0)
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_load1_noabort+0x88/0x90 mm/kasan/report.c:430
hfs_strcmp+0x143/0x170 fs/hfs/string.c:84
hfs_cat_keycmp+0x179/0x1c0 fs/hfs/catalog.c:181
__hfs_brec_find+0x1cc/0x4d0 fs/hfs/bfind.c:75
hfs_brec_find+0x1fe/0x4e0 fs/hfs/bfind.c:138
hfs_write_inode+0x345/0x930 fs/hfs/inode.c:457
write_inode fs/fs-writeback.c:1244 [inline]
__writeback_single_inode+0x733/0x11d0 fs/fs-writeback.c:1442
writeback_sb_inodes+0x537/0xef0 fs/fs-writeback.c:1647
wb_writeback+0x28d/0xcc0 fs/fs-writeback.c:1820
wb_do_writeback fs/fs-writeback.c:1965 [inline]
wb_workfn+0x29b/0x1250 fs/fs-writeback.c:2006
process_one_work+0x864/0x1570 kernel/workqueue.c:2153
worker_thread+0x64c/0x1130 kernel/workqueue.c:2296
kthread+0x33f/0x460 kernel/kthread.c:259
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Allocated by task 7:
__do_kmalloc mm/slab.c:3727 [inline]
__kmalloc+0x15a/0x3c0 mm/slab.c:3736
kmalloc include/linux/slab.h:520 [inline]
hfs_find_init+0x91/0x230 fs/hfs/bfind.c:21
hfs_write_inode+0x221/0x930 fs/hfs/inode.c:452
write_inode fs/fs-writeback.c:1244 [inline]
__writeback_single_inode+0x733/0x11d0 fs/fs-writeback.c:1442
writeback_sb_inodes+0x537/0xef0 fs/fs-writeback.c:1647
wb_writeback+0x28d/0xcc0 fs/fs-writeback.c:1820
wb_do_writeback fs/fs-writeback.c:1965 [inline]
wb_workfn+0x29b/0x1250 fs/fs-writeback.c:2006
process_one_work+0x864/0x1570 kernel/workqueue.c:2153
worker_thread+0x64c/0x1130 kernel/workqueue.c:2296
kthread+0x33f/0x460 kernel/kthread.c:259
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Freed by task 6321:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
aa_free_file_ctx security/apparmor/include/file.h:76 [inline]
apparmor_file_free_security+0x9a/0xd0 security/apparmor/lsm.c:448
security_file_free+0x3e/0x70 security/security.c:885
file_free fs/file_table.c:54 [inline]
__fput+0x42a/0x890 fs/file_table.c:294
task_work_run+0x148/0x1c0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:193 [inline]
exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880b2f4a580
which belongs to the cache kmalloc-96 of size 96
The buggy address is located 78 bytes inside of
96-byte region [ffff8880b2f4a580, ffff8880b2f4a5e0)
The buggy address belongs to the page:
page:ffffea0002cbd280 count:1 mapcount:0 mapping:ffff88813bff04c0 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea0002c93608 ffffea0002a92808 ffff88813bff04c0
raw: 0000000000000000 ffff8880b2f4a000 0000000100000020 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880b2f4a480: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff8880b2f4a500: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>ffff8880b2f4a580: 00 00 00 00 00 00 00 00 00 06 fc fc fc fc fc fc
^
ffff8880b2f4a600: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff8880b2f4a680: fb fb fb fb fb fb fb fb fb fb fb fb 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
Reply all
Reply to author
Forward
0 new messages