syzbot


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

Status: upstream: reported C repro on 2022/11/26 10:26
Reported-by: syzbot+9b41ed445bcf0d9efcd6@syzkaller.appspotmail.com
First crash: 748d, last: 747d
Fix bisection: failed (error log, bisect log)
  
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 36 5d01h 542d 0/3 upstream: reported C repro on 2023/06/20 20:03
linux-4.14 KASAN: slab-out-of-bounds Read in hfsplus_bnode_read hfsplus C 3 649d 741d 0/1 upstream: reported C repro on 2022/12/03 05:45
upstream KASAN: slab-out-of-bounds Read in hfsplus_bnode_read hfs C error 53 13d 748d 0/28 upstream: reported C repro on 2022/11/26 08:07

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+0x19b/0x1b0 fs/hfsplus/bnode.c:32
Read of size 8 at addr ffff8880b4b837b8 by task syz-executor263/8094

CPU: 0 PID: 8094 Comm: syz-executor263 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
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_load8_noabort+0x88/0x90 mm/kasan/report.c:433
 hfsplus_bnode_read+0x19b/0x1b0 fs/hfsplus/bnode.c:32
 hfsplus_bnode_read_u16 fs/hfsplus/bnode.c:47 [inline]
 hfsplus_bnode_dump+0x2c2/0x3a0 fs/hfsplus/bnode.c:328
 hfsplus_brec_remove+0x3d7/0x4e0 fs/hfsplus/brec.c:229
 __hfsplus_delete_attr+0x217/0x370 fs/hfsplus/attributes.c:299
 hfsplus_delete_all_attrs+0x149/0x3f0 fs/hfsplus/attributes.c:378
 hfsplus_delete_cat+0x824/0xe30 fs/hfsplus/catalog.c:425
 hfsplus_unlink+0x1d2/0x820 fs/hfsplus/dir.c:385
 vfs_unlink+0x27d/0x4e0 fs/namei.c:4002
 do_unlinkat+0x3b8/0x660 fs/namei.c:4065
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f7b69230829
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:00007ffceb28df28 EFLAGS: 00000246 ORIG_RAX: 0000000000000057
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f7b69230829
RDX: 00007f7b691eeea3 RSI: 0000000000000000 RDI: 0000000020000000
RBP: 00007f7b691f00c0 R08: 00000000000005f2 R09: 0000000000000000
R10: 00007ffceb28ddf0 R11: 0000000000000246 R12: 00007f7b691f0150
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 8094:
 __do_kmalloc mm/slab.c:3727 [inline]
 __kmalloc+0x15a/0x3c0 mm/slab.c:3736
 kmalloc include/linux/slab.h:520 [inline]
 kzalloc include/linux/slab.h:709 [inline]
 __hfs_bnode_create+0x105/0xb60 fs/hfsplus/bnode.c:416
 hfsplus_bnode_find+0x2aa/0xb80 fs/hfsplus/bnode.c:497
 hfsplus_brec_find+0x2af/0x500 fs/hfsplus/bfind.c:183
 hfsplus_find_attr fs/hfsplus/attributes.c:160 [inline]
 hfsplus_delete_all_attrs+0x2dd/0x3f0 fs/hfsplus/attributes.c:371
 hfsplus_delete_cat+0x824/0xe30 fs/hfsplus/catalog.c:425
 hfsplus_unlink+0x1d2/0x820 fs/hfsplus/dir.c:385
 vfs_unlink+0x27d/0x4e0 fs/namei.c:4002
 do_unlinkat+0x3b8/0x660 fs/namei.c:4065
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 1:
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcc/0x210 mm/slab.c:3822
 ___sys_sendmsg+0x4ba/0x8e0 net/socket.c:2243
 __sys_sendmsg net/socket.c:2265 [inline]
 __do_sys_sendmsg net/socket.c:2274 [inline]
 __se_sys_sendmsg net/socket.c:2272 [inline]
 __x64_sys_sendmsg+0x132/0x220 net/socket.c:2272
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880b4b83700
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 184 bytes inside of
 192-byte region [ffff8880b4b83700, ffff8880b4b837c0)
The buggy address belongs to the page:
page:ffffea0002d2e0c0 count:1 mapcount:0 mapping:ffff88813bff0040 index:0xffff8880b4b83600
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea0002925ec8 ffffea0002d1b108 ffff88813bff0040
raw: ffff8880b4b83600 ffff8880b4b83000 0000000100000006 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880b4b83680: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8880b4b83700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880b4b83780: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                        ^
 ffff8880b4b83800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880b4b83880: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

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