syzbot


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

Status: upstream: reported C repro on 2022/12/02 03:19
Reported-by: syzbot+19f4755b8713c0c94299@syzkaller.appspotmail.com
First crash: 720d, last: 720d
Fix bisection: failed (error log, bisect log)
  
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Read in hfs_cat_keycmp hfs C error done 2 639d 704d 22/28 fixed on 2023/02/24 13:50
upstream KMSAN: uninit-value in hfs_cat_keycmp (2) hfs C 4 38d 316d 0/28 upstream: reported C repro on 2024/01/10 10:16
upstream KMSAN: uninit-value in hfs_cat_keycmp hfs 5 396d 493d 0/28 closed as invalid on 2023/12/22 16:00

Sample crash report:
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
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/12/02 03:19 linux-4.19.y 3f8a27f9e27b e080de16 .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 KASAN: slab-out-of-bounds Read in hfs_cat_keycmp
* Struck through repros no longer work on HEAD.