syzbot


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

Status: upstream: reported C repro on 2022/11/26 08:07
Reported-by: syzbot+e76bf3d19b85350571ac@syzkaller.appspotmail.com
First crash: 71d, last: 4d05h

Cause bisection: failed (bisect log)
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: slab-out-of-bounds Read in hfsplus_bnode_read C error 2 70d 71d 0/1 upstream: reported C repro on 2022/11/26 10:26
linux-4.14 KASAN: slab-out-of-bounds Read in hfsplus_bnode_read hfsplus C 3 2d13h 64d 0/1 upstream: reported C repro on 2022/12/03 05:45

Sample crash report:
loop0: detected capacity change from 0 to 1024
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+0x144/0x150 fs/hfsplus/bnode.c:32
Read of size 8 at addr ffff888017b25ac0 by task syz-executor116/3629

CPU: 0 PID: 3629 Comm: syz-executor116 Not tainted 6.1.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x15e/0x45d mm/kasan/report.c:395
 kasan_report+0xbf/0x1f0 mm/kasan/report.c:495
 hfsplus_bnode_read+0x144/0x150 fs/hfsplus/bnode.c:32
 hfsplus_bnode_read_u16 fs/hfsplus/bnode.c:45 [inline]
 hfsplus_bnode_dump+0x2c6/0x3a0 fs/hfsplus/bnode.c:321
 hfsplus_brec_remove+0x3db/0x4f0 fs/hfsplus/brec.c:229
 __hfsplus_delete_attr+0x217/0x380 fs/hfsplus/attributes.c:299
 hfsplus_delete_all_attrs+0x25d/0x2d0 fs/hfsplus/attributes.c:378
 hfsplus_delete_cat+0x86a/0xe40 fs/hfsplus/catalog.c:425
 hfsplus_unlink+0x1e3/0x830 fs/hfsplus/dir.c:385
 vfs_unlink+0x355/0x930 fs/namei.c:4252
 do_unlinkat+0x3d0/0x660 fs/namei.c:4320
 __do_sys_unlink fs/namei.c:4368 [inline]
 __se_sys_unlink fs/namei.c:4366 [inline]
 __x64_sys_unlink+0xca/0x110 fs/namei.c:4366
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f293f94c809
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:00007fffa3254b78 EFLAGS: 00000246 ORIG_RAX: 0000000000000057
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f293f94c809
RDX: 00007f293f90ae83 RSI: 0000000000000000 RDI: 0000000020000000
RBP: 00007f293f90c0a0 R08: 00000000000005f2 R09: 0000000000000000
R10: 00007fffa3254a40 R11: 0000000000000246 R12: 00007f293f90c130
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Allocated by task 3629:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:371 [inline]
 ____kasan_kmalloc mm/kasan/common.c:330 [inline]
 __kasan_kmalloc+0xa5/0xb0 mm/kasan/common.c:380
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slab_common.c:955 [inline]
 __kmalloc+0x5a/0xd0 mm/slab_common.c:968
 kmalloc include/linux/slab.h:558 [inline]
 kzalloc include/linux/slab.h:689 [inline]
 __hfs_bnode_create+0x107/0x820 fs/hfsplus/bnode.c:409
 hfsplus_bnode_find+0x408/0xc50 fs/hfsplus/bnode.c:486
 hfsplus_brec_find+0x2b3/0x510 fs/hfsplus/bfind.c:183
 hfsplus_find_attr fs/hfsplus/attributes.c:160 [inline]
 hfsplus_delete_all_attrs+0x236/0x2d0 fs/hfsplus/attributes.c:371
 hfsplus_delete_cat+0x86a/0xe40 fs/hfsplus/catalog.c:425
 hfsplus_unlink+0x1e3/0x830 fs/hfsplus/dir.c:385
 vfs_unlink+0x355/0x930 fs/namei.c:4252
 do_unlinkat+0x3d0/0x660 fs/namei.c:4320
 __do_sys_unlink fs/namei.c:4368 [inline]
 __se_sys_unlink fs/namei.c:4366 [inline]
 __x64_sys_unlink+0xca/0x110 fs/namei.c:4366
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff888017b25a00
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 0 bytes to the right of
 192-byte region [ffff888017b25a00, ffff888017b25ac0)

The buggy address belongs to the physical page:
page:ffffea00005ec940 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x17b25
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea00005e7480 dead000000000004 ffff888012041a00
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, tgid 1 (swapper/0), ts 1549796022, free_ts 0
 prep_new_page mm/page_alloc.c:2539 [inline]
 get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4291
 __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5558
 alloc_page_interleave+0x1e/0x200 mm/mempolicy.c:2118
 alloc_pages+0x233/0x270 mm/mempolicy.c:2280
 alloc_slab_page mm/slub.c:1794 [inline]
 allocate_slab+0x25f/0x350 mm/slub.c:1939
 new_slab mm/slub.c:1992 [inline]
 ___slab_alloc+0xa91/0x1400 mm/slub.c:3180
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3279
 slab_alloc_node mm/slub.c:3364 [inline]
 __kmem_cache_alloc_node+0x199/0x3e0 mm/slub.c:3437
 kmalloc_trace+0x26/0x60 mm/slab_common.c:1045
 kmalloc include/linux/slab.h:553 [inline]
 kzalloc include/linux/slab.h:689 [inline]
 call_usermodehelper_setup+0x9b/0x340 kernel/umh.c:366
 kobject_uevent_env+0xed3/0x1620 lib/kobject_uevent.c:614
 kernel_add_sysfs_param kernel/params.c:816 [inline]
 param_sysfs_builtin kernel/params.c:851 [inline]
 param_sysfs_init+0x36b/0x43f kernel/params.c:970
 do_one_initcall+0x141/0x780 init/main.c:1303
 do_initcall_level init/main.c:1376 [inline]
 do_initcalls init/main.c:1392 [inline]
 do_basic_setup init/main.c:1411 [inline]
 kernel_init_freeable+0x6ff/0x788 init/main.c:1631
 kernel_init+0x1e/0x1d0 init/main.c:1519
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888017b25980: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff888017b25a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888017b25a80: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
                                           ^
 ffff888017b25b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888017b25b80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Fix bisection attempts:
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce-root 2023/02/01 06:48 upstream c0b67534c95c 67be1ae7 .config console log report syz C
* Struck through repros no longer work on HEAD.
Crashes (6):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce-root 2022/12/12 23:20 upstream 830b3c68c1fb 67be1ae7 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: slab-out-of-bounds Read in hfsplus_bnode_read
ci-upstream-kasan-gce-root 2022/12/11 04:46 upstream 296a7b7eb792 67be1ae7 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: slab-out-of-bounds Read in hfsplus_bnode_read
ci2-upstream-fs 2022/11/27 20:03 upstream faf68e3523c2 f4470a7b .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: slab-out-of-bounds Read in hfsplus_bnode_read
ci2-upstream-fs 2022/11/25 22:12 upstream 08ad43d554ba f4470a7b .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: slab-out-of-bounds Read in hfsplus_bnode_read
ci2-upstream-fs 2022/12/24 23:35 upstream 72a85e2b0a1e 9da18ae8 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: wild-memory-access Read in hfsplus_bnode_read
ci2-upstream-fs 2022/11/27 16:50 upstream faf68e3523c2 f4470a7b .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_bnode_read
* Struck through repros no longer work on HEAD.