syzbot


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

Status: upstream: reported C repro on 2022/11/26 08:07
Labels: hfs (incorrect?)
Reported-by: syzbot+e76bf3d19b85350571ac@syzkaller.appspotmail.com
First crash: 194d, last: 1d19h

Cause bisection: failed (error log, bisect log)
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] KASAN: slab-out-of-bounds Read in hfsplus_bnode_read 0 (1) 2022/11/26 08:07
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 192d 193d 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 95d 187d 0/1 upstream: reported C repro on 2022/12/03 05:45
Fix bisection attempts (5)
Created Duration User Patch Repo Result
2023/06/01 22:38 25m bisect fix upstream job log (0) log
2023/05/02 20:34 1h00m bisect fix upstream job log (0) log
2023/04/02 11:08 38m bisect fix upstream job log (0) log
2023/03/03 10:30 38m bisect fix upstream job log (0) log
2023/02/01 06:21 27m bisect fix upstream job log (0) log

Sample crash report:
=======================================================
hfsplus: request for non-existent node 256 in B*Tree
hfsplus: request for non-existent node 256 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 ffff888012eaa3c0 by task syz-executor378/4998

CPU: 0 PID: 4998 Comm: syz-executor378 Not tainted 6.4.0-rc5-syzkaller-00002-gf8dba31b0a82 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351
 print_report mm/kasan/report.c:462 [inline]
 kasan_report+0x11c/0x130 mm/kasan/report.c:572
 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+0x28a/0x3a0 fs/hfsplus/attributes.c:299
 hfsplus_delete_all_attrs+0x25d/0x320 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:4327
 do_unlinkat+0x3e3/0x680 fs/namei.c:4393
 __do_sys_unlink fs/namei.c:4441 [inline]
 __se_sys_unlink fs/namei.c:4439 [inline]
 __x64_sys_unlink+0xca/0x110 fs/namei.c:4439
 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:0x7f7655a3f789
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:00007ffc7891ea88 EFLAGS: 00000246 ORIG_RAX: 0000000000000057
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f7655a3f789
RDX: 00007f76559fde03 RSI: 0000000000000000 RDI: 0000000020000000
RBP: 00007f76559ff020 R08: 000000000000066d R09: 0000000000000000
R10: 00007ffc7891e950 R11: 0000000000000246 R12: 00007f76559ff0b0
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Allocated by task 4998:
 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:374 [inline]
 ____kasan_kmalloc mm/kasan/common.c:333 [inline]
 __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:196 [inline]
 __do_kmalloc_node mm/slab_common.c:966 [inline]
 __kmalloc+0x5e/0x190 mm/slab_common.c:979
 kmalloc include/linux/slab.h:563 [inline]
 kzalloc include/linux/slab.h:680 [inline]
 __hfs_bnode_create+0x107/0x840 fs/hfsplus/bnode.c:409
 hfsplus_bnode_find+0x41c/0xc60 fs/hfsplus/bnode.c:486
 hfsplus_brec_find+0x2b3/0x520 fs/hfsplus/bfind.c:183
 hfsplus_find_attr fs/hfsplus/attributes.c:160 [inline]
 hfsplus_delete_all_attrs+0x236/0x320 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:4327
 do_unlinkat+0x3e3/0x680 fs/namei.c:4393
 __do_sys_unlink fs/namei.c:4441 [inline]
 __se_sys_unlink fs/namei.c:4439 [inline]
 __x64_sys_unlink+0xca/0x110 fs/namei.c:4439
 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 ffff888012eaa300
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 40 bytes to the right of
 allocated 152-byte region [ffff888012eaa300, ffff888012eaa398)

The buggy address belongs to the physical page:
page:ffffea00004baa80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12eaa
anon flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000200 ffff888012441a00 0000000000000000 dead000000000001
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 12, tgid 12 (kworker/u4:1), ts 1767188754, free_ts 0
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2db/0x350 mm/page_alloc.c:1731
 prep_new_page mm/page_alloc.c:1738 [inline]
 get_page_from_freelist+0xf41/0x2c00 mm/page_alloc.c:3502
 __alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:4768
 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2279
 alloc_slab_page mm/slub.c:1851 [inline]
 allocate_slab+0x25f/0x390 mm/slub.c:1998
 new_slab mm/slub.c:2051 [inline]
 ___slab_alloc+0xa91/0x1400 mm/slub.c:3192
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3291
 __slab_alloc_node mm/slub.c:3344 [inline]
 slab_alloc_node mm/slub.c:3441 [inline]
 __kmem_cache_alloc_node+0x136/0x320 mm/slub.c:3490
 kmalloc_node_trace+0x21/0xd0 mm/slab_common.c:1070
 kmalloc_node include/linux/slab.h:575 [inline]
 kzalloc_node include/linux/slab.h:691 [inline]
 alloc_worker+0x43/0x1c0 kernel/workqueue.c:1849
 create_worker+0xcc/0x620 kernel/workqueue.c:1949
 maybe_create_worker kernel/workqueue.c:2223 [inline]
 manage_workers kernel/workqueue.c:2275 [inline]
 worker_thread+0xadf/0x10c0 kernel/workqueue.c:2524
 kthread+0x344/0x440 kernel/kthread.c:379
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888012eaa280: 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888012eaa300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888012eaa380: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
                                           ^
 ffff888012eaa400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888012eaa480: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

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