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: 548d, last: 2d08h
Fix bisection: failed (error log, bisect log)
  
Bug presence (1)
Date Name Commit Repro Result
2024/11/12 upstream (ToT) 14b6320953a3 C [report] KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Write in hfs_bnode_read hfs C inconclusive 4 11d 7d09h 0/28 upstream: reported C repro on 2024/11/27 09:48
Last patch testing requests (2)
Created Duration User Patch Repo Result
2024/11/11 01:56 10m retest repro linux-5.15.y report log
2024/10/25 05:54 11m retest repro linux-5.15.y report log

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+0x179/0x2a0 fs/hfs/bnode.c:37
Write of size 256 at addr ffff88801e67f000 by task syz-executor210/3505

CPU: 1 PID: 3505 Comm: syz-executor210 Not tainted 5.15.118-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 kasan_check_range+0x27e/0x290 mm/kasan/generic.c:189
 memcpy+0x3c/0x60 mm/kasan/shadow.c:66
 hfs_bnode_read+0x179/0x2a0 fs/hfs/bnode.c:37
 hfs_bnode_read_key+0x16e/0x240 fs/hfs/bnode.c:73
 hfs_brec_insert+0x69d/0xbd0 fs/hfs/brec.c:141
 hfs_cat_create+0x5db/0xa60 fs/hfs/catalog.c:131
 hfs_create+0x62/0xd0 fs/hfs/dir.c:202
 lookup_open fs/namei.c:3392 [inline]
 open_last_lookups fs/namei.c:3462 [inline]
 path_openat+0x12f6/0x2f20 fs/namei.c:3669
 do_filp_open+0x21c/0x460 fs/namei.c:3699
 do_sys_openat2+0x13b/0x500 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]
 __x64_sys_openat+0x243/0x290 fs/open.c:1238
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f5233a46b49
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:00007ffca3d8cb38 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f5233a46b49
RDX: 0000000000141842 RSI: 0000000020000380 RDI: 00000000ffffff9c
RBP: 00007f5233a06150 R08: 0000000000000260 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5233a061e0
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Allocated by task 3505:
 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+0xba/0xf0 mm/kasan/common.c:513
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 __kmalloc+0x168/0x300 mm/slub.c:4407
 kmalloc include/linux/slab.h:596 [inline]
 hfs_find_init+0x8c/0x1e0 fs/hfs/bfind.c:21
 hfs_cat_create+0x17e/0xa60 fs/hfs/catalog.c:96
 hfs_create+0x62/0xd0 fs/hfs/dir.c:202
 lookup_open fs/namei.c:3392 [inline]
 open_last_lookups fs/namei.c:3462 [inline]
 path_openat+0x12f6/0x2f20 fs/namei.c:3669
 do_filp_open+0x21c/0x460 fs/namei.c:3699
 do_sys_openat2+0x13b/0x500 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]
 __x64_sys_openat+0x243/0x290 fs/open.c:1238
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff88801e67f000
 which belongs to the cache kmalloc-96 of size 96
The buggy address is located 0 bytes inside of
 96-byte region [ffff88801e67f000, ffff88801e67f060)
The buggy address belongs to the page:
page:ffffea0000799fc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1e67f
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea0001d3bf40 0000000600000006 ffff888011c41780
raw: 0000000000000000 0000000080200020 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 0x12c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY), pid 2969, ts 18771314214, free_ts 18768438905
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5421
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 __kmalloc+0x1c9/0x300 mm/slub.c:4403
 kmalloc include/linux/slab.h:596 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 tomoyo_encode2 security/tomoyo/realpath.c:45 [inline]
 tomoyo_encode+0x26b/0x530 security/tomoyo/realpath.c:80
 tomoyo_realpath_from_path+0x5a2/0x5e0 security/tomoyo/realpath.c:288
 tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
 tomoyo_path_perm+0x273/0x6b0 security/tomoyo/file.c:822
 tomoyo_path_symlink+0xda/0x110 security/tomoyo/tomoyo.c:199
 security_path_symlink+0xd9/0x130 security/security.c:1179
 do_symlinkat+0x129/0x600 fs/namei.c:4382
 __do_sys_symlink fs/namei.c:4409 [inline]
 __se_sys_symlink fs/namei.c:4407 [inline]
 __x64_sys_symlink+0x7a/0x90 fs/namei.c:4407
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 mm_free_pgd kernel/fork.c:652 [inline]
 __mmdrop+0xac/0x3e0 kernel/fork.c:703
 mmdrop include/linux/sched/mm.h:49 [inline]
 finish_task_switch+0x218/0x630 kernel/sched/core.c:4925
 context_switch kernel/sched/core.c:5029 [inline]
 __schedule+0x12cc/0x4590 kernel/sched/core.c:6372
 schedule+0x11b/0x1f0 kernel/sched/core.c:6455
 schedule_hrtimeout_range_clock+0x27f/0x470 kernel/time/hrtimer.c:2307
 ep_poll+0x199a/0x1c60 fs/eventpoll.c:1877
 do_epoll_wait+0x1ae/0x220 fs/eventpoll.c:2255
 __do_sys_epoll_wait fs/eventpoll.c:2267 [inline]
 __se_sys_epoll_wait fs/eventpoll.c:2262 [inline]
 __x64_sys_epoll_wait+0x253/0x2a0 fs/eventpoll.c:2262
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Memory state around the buggy address:
 ffff88801e67ef00: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
 ffff88801e67ef80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88801e67f000: 00 00 00 00 00 00 00 00 00 06 fc fc fc fc fc fc
                                              ^
 ffff88801e67f080: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff88801e67f100: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
==================================================================

Crashes (11):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
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
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
2024/12/02 10:47 linux-5.15.y 0a51d2d4527b 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read
2024/11/29 15:47 linux-5.15.y 0a51d2d4527b 5df23865 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read
2024/11/25 14:57 linux-5.15.y 0a51d2d4527b 68da6d95 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read
2024/11/23 09:42 linux-5.15.y 0a51d2d4527b 68da6d95 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read
2024/12/01 02:51 linux-5.15.y 0a51d2d4527b 68914665 .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
2024/11/28 22:14 linux-5.15.y 0a51d2d4527b 5df23865 .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
2024/11/11 09:03 linux-5.15.y 3c17fc483905 6b856513 .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
2024/10/27 22:45 linux-5.15.y 74cdd62cb470 65e8686b .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
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.