syzbot


KASAN: slab-out-of-bounds Write in hfs_bnode_read

Status: upstream: reported C repro on 2023/06/04 19:50
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+7c622e858e9150895fda@syzkaller.appspotmail.com
First crash: 499d, last: 8d08h
Fix bisection: failed (error log, bisect log)
  
Bug presence (2)
Date Name Commit Repro Result
2023/06/05 upstream (ToT) 9561de3a55be C [report] KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/10/15 upstream (ToT) eca631b8fe80 C Failed due to an error; will retry later

Sample crash report:
loop0: detected capacity change from 0 to 64
hfs: unable to locate alternate MDB
hfs: continuing without an alternate MDB
==================================================================
BUG: KASAN: slab-out-of-bounds in hfs_bnode_read+0x1b4/0x2dc fs/hfs/bnode.c:37
Write of size 256 at addr ffff0000cfc35700 by task syz-executor583/3959

CPU: 1 PID: 3959 Comm: syz-executor583 Not tainted 5.15.114-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023
Call trace:
 dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description+0x7c/0x3f0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x174/0x1e4 mm/kasan/report.c:451
 kasan_check_range+0x274/0x2b4 mm/kasan/generic.c:189
 memcpy+0xb4/0xe8 mm/kasan/shadow.c:66
 hfs_bnode_read+0x1b4/0x2dc fs/hfs/bnode.c:37
 hfs_bnode_read_key+0x154/0x21c fs/hfs/bnode.c:73
 hfs_brec_insert+0x508/0x97c fs/hfs/brec.c:141
 hfs_cat_create+0x4f0/0x844 fs/hfs/catalog.c:131
 hfs_create+0x70/0xe4 fs/hfs/dir.c:202
 lookup_open fs/namei.c:3392 [inline]
 open_last_lookups fs/namei.c:3462 [inline]
 path_openat+0xec0/0x26f0 fs/namei.c:3669
 do_filp_open+0x1a8/0x3b4 fs/namei.c:3699
 do_sys_openat2+0x128/0x3d8 fs/open.c:1211
 do_sys_open fs/open.c:1227 [inline]
 __do_sys_openat fs/open.c:1243 [inline]
 __se_sys_openat fs/open.c:1238 [inline]
 __arm64_sys_openat+0x1f0/0x240 fs/open.c:1238
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Allocated by task 3959:
 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+0xbc/0xfc mm/kasan/common.c:513
 __kasan_kmalloc+0x10/0x1c mm/kasan/common.c:522
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 __kmalloc+0x29c/0x4c8 mm/slub.c:4407
 kmalloc include/linux/slab.h:596 [inline]
 hfs_find_init+0x88/0x1c8 fs/hfs/bfind.c:21
 hfs_cat_create+0x168/0x844 fs/hfs/catalog.c:96
 hfs_create+0x70/0xe4 fs/hfs/dir.c:202
 lookup_open fs/namei.c:3392 [inline]
 open_last_lookups fs/namei.c:3462 [inline]
 path_openat+0xec0/0x26f0 fs/namei.c:3669
 do_filp_open+0x1a8/0x3b4 fs/namei.c:3699
 do_sys_openat2+0x128/0x3d8 fs/open.c:1211
 do_sys_open fs/open.c:1227 [inline]
 __do_sys_openat fs/open.c:1243 [inline]
 __se_sys_openat fs/open.c:1238 [inline]
 __arm64_sys_openat+0x1f0/0x240 fs/open.c:1238
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

The buggy address belongs to the object at ffff0000cfc35700
 which belongs to the cache kmalloc-128 of size 128
The buggy address is located 0 bytes inside of
 128-byte region [ffff0000cfc35700, ffff0000cfc35780)
The buggy address belongs to the page:
page:000000006bed105e refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10fc35
flags: 0x5ffc00000000200(slab|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000000200 fffffc00033f0dc0 0000000300000003 ffff0000c0002300
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000cfc35600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000cfc35680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000cfc35700: 00 00 00 00 00 00 00 00 00 06 fc fc fc fc fc fc
                                              ^
 ffff0000cfc35780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff0000cfc35800: fb fb fb fb fb fb fb fb fb fb

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/04 19:49 linux-5.15.y 0ab06468cbd1 a4ae4f42 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan-arm64 KASAN: slab-out-of-bounds Write in hfs_bnode_read
2023/06/25 11:33 linux-5.15.y f67653019430 79782afc .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read
2024/10/07 14:41 linux-5.15.y 3a5928702e71 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: slab-out-of-bounds Write in hfs_bnode_read
* Struck through repros no longer work on HEAD.