syzbot


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

Status: upstream: reported C repro on 2022/12/03 05:45
Subsystems: hfsplus
[Documentation on labels]
Reported-by: syzbot+cd6cdb4dfa56c70a38dd@syzkaller.appspotmail.com
First crash: 559d, last: 467d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: slab-out-of-bounds Read in hfsplus_bnode_read origin:upstream C 20 14d 359d 0/3 upstream: reported C repro on 2023/06/20 20:03
linux-4.19 KASAN: slab-out-of-bounds Read in hfsplus_bnode_read C error 2 565d 566d 0/1 upstream: reported C repro on 2022/11/26 10:26
upstream KASAN: slab-out-of-bounds Read in hfsplus_bnode_read hfs C error 46 9h17m 566d 0/27 upstream: reported C repro on 2022/11/26 08:07
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2023/03/04 23:17 21m bisect fix linux-4.14.y job log (0) log
2023/02/02 22:45 31m bisect fix linux-4.14.y job log (0) log

Sample crash report:
hfsplus: request for non-existent node 393216 in B*Tree
hfsplus: request for non-existent node 393216 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 ffff8880abbacbb8 by task syz-executor997/8004

CPU: 1 PID: 8004 Comm: syz-executor997 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 8004:
 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 7715:
 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 ffff8880abbacb00
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 184 bytes inside of
 192-byte region [ffff8880abbacb00, ffff8880abbacbc0)
The buggy address belongs to the page:
page:ffffea0002aeeb00 count:1 mapcount:0 mapping:ffff8880abbac000 index:0xffff8880abbacf00
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880abbac000 ffff8880abbacf00 000000010000000e
raw: ffffea0002ae29a0 ffffea0002aec4e0 ffff88813fe74040 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880abbaca80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8880abbacb00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880abbacb80: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                        ^
 ffff8880abbacc00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880abbacc80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/12/04 04:24 linux-4.14.y 179ef7fe8677 e080de16 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-4-14 KASAN: slab-out-of-bounds Read in hfsplus_bnode_read
2022/12/03 05:45 linux-4.14.y 179ef7fe8677 e080de16 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-4-14 KASAN: slab-out-of-bounds Read in hfsplus_bnode_read
2023/01/01 12:13 linux-4.14.y c4215ee4771b ab32d508 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-4-14 KASAN: wild-memory-access Read in hfsplus_bnode_read
* Struck through repros no longer work on HEAD.