syzbot


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

Status: upstream: reported C repro on 2023/06/04 20:20
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+4be1354b4526d3f6335d@syzkaller.appspotmail.com
First crash: 570d, last: 8d06h
Fix bisection: failed (error log, bisect log)
  
Bug presence (1)
Date Name Commit Repro Result
2023/09/30 upstream (ToT) 9f3ebbef746f C [report] KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Write in hfs_bnode_read_key hfs C error done 4 344d 566d 25/28 fixed on 2024/03/20 11:33
upstream KASAN: slab-out-of-bounds Write in hfs_bnode_read_key (2) hfs C inconclusive 1056 1h22m 83d 0/28 upstream: reported C repro on 2024/10/03 13:51
Fix bisection attempts (13)
Created Duration User Patch Repo Result
2024/10/15 01:52 0m bisect fix linux-6.1.y error job log
2024/09/10 18:41 1h07m bisect fix linux-6.1.y OK (0) job log log
2024/08/07 20:03 1h17m bisect fix linux-6.1.y OK (0) job log log
2024/06/28 09:43 1h47m bisect fix linux-6.1.y OK (0) job log log
2024/05/20 01:22 1h08m bisect fix linux-6.1.y OK (0) job log log
2024/04/15 22:51 1h56m bisect fix linux-6.1.y OK (0) job log log
2024/03/13 04:56 1h23m bisect fix linux-6.1.y OK (0) job log log
2024/02/03 15:10 1h31m (2) bisect fix linux-6.1.y OK (0) job log log
2023/12/31 14:32 1h10m bisect fix linux-6.1.y OK (0) job log log
2023/12/01 08:19 1h11m bisect fix linux-6.1.y OK (0) job log log
2023/10/31 05:11 1h25m bisect fix linux-6.1.y OK (0) job log log
2023/09/30 00:38 1h20m bisect fix linux-6.1.y OK (0) job log log
2023/07/10 02:24 3h04m bisect fix linux-6.1.y OK (0) job log log

Sample crash report:
loop0: detected capacity change from 0 to 64
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy_from_page include/linux/highmem.h:393 [inline]
BUG: KASAN: slab-out-of-bounds in hfs_bnode_read fs/hfs/bnode.c:35 [inline]
BUG: KASAN: slab-out-of-bounds in hfs_bnode_read_key+0x310/0x440 fs/hfs/bnode.c:70
Write of size 94 at addr ffff888029076f80 by task syz-executor988/4240

CPU: 1 PID: 4240 Comm: syz-executor988 Not tainted 6.1.119-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:395
 kasan_report+0x136/0x160 mm/kasan/report.c:495
 kasan_check_range+0x27f/0x290 mm/kasan/generic.c:189
 memcpy+0x3c/0x60 mm/kasan/shadow.c:66
 memcpy_from_page include/linux/highmem.h:393 [inline]
 hfs_bnode_read fs/hfs/bnode.c:35 [inline]
 hfs_bnode_read_key+0x310/0x440 fs/hfs/bnode.c:70
 hfs_brec_insert+0x7ef/0xbd0 fs/hfs/brec.c:159
 hfs_cat_move+0x572/0x1050 fs/hfs/catalog.c:336
 hfs_rename+0x242/0x320 fs/hfs/dir.c:299
 vfs_rename+0xd32/0x10f0 fs/namei.c:4874
 do_renameat2+0xde0/0x1440 fs/namei.c:5027
 __do_sys_renameat2 fs/namei.c:5060 [inline]
 __se_sys_renameat2 fs/namei.c:5057 [inline]
 __x64_sys_renameat2+0xce/0xe0 fs/namei.c:5057
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f5f8f7a1679
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 17 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe80e52b48 EFLAGS: 00000246 ORIG_RAX: 000000000000013c
RAX: ffffffffffffffda RBX: 00007ffe80e52d18 RCX: 00007f5f8f7a1679
RDX: 0000000000000004 RSI: 0000000020000380 RDI: 0000000000000004
RBP: 00007f5f8f814610 R08: 0000000000000000 R09: 00007ffe80e52d18
R10: 0000000020000200 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffe80e52d08 R14: 0000000000000001 R15: 0000000000000001
 </TASK>

Allocated by task 4240:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slab_common.c:936 [inline]
 __kmalloc+0xb2/0x230 mm/slab_common.c:949
 kmalloc include/linux/slab.h:562 [inline]
 hfs_find_init+0x8c/0x1e0 fs/hfs/bfind.c:21
 hfs_cat_move+0x143/0x1050 fs/hfs/catalog.c:301
 hfs_rename+0x242/0x320 fs/hfs/dir.c:299
 vfs_rename+0xd32/0x10f0 fs/namei.c:4874
 do_renameat2+0xde0/0x1440 fs/namei.c:5027
 __do_sys_renameat2 fs/namei.c:5060 [inline]
 __se_sys_renameat2 fs/namei.c:5057 [inline]
 __x64_sys_renameat2+0xce/0xe0 fs/namei.c:5057
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff888029076f80
 which belongs to the cache kmalloc-96 of size 96
The buggy address is located 0 bytes inside of
 96-byte region [ffff888029076f80, ffff888029076fe0)

The buggy address belongs to the physical page:
page:ffffea0000a41d80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x29076
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea000078ad80 dead000000000004 ffff888017c41780
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 3636, tgid 3636 (udevadm), ts 18649433585, free_ts 18639228915
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2517
 prep_new_page mm/page_alloc.c:2524 [inline]
 get_page_from_freelist+0x3731/0x38d0 mm/page_alloc.c:4313
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5590
 alloc_slab_page+0x6a/0x150 mm/slub.c:1794
 allocate_slab mm/slub.c:1939 [inline]
 new_slab+0x84/0x2d0 mm/slub.c:1992
 ___slab_alloc+0xc20/0x1270 mm/slub.c:3180
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 __kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:935 [inline]
 __kmalloc+0xa1/0x230 mm/slab_common.c:949
 kmalloc include/linux/slab.h:562 [inline]
 kzalloc include/linux/slab.h:693 [inline]
 tomoyo_encode2 security/tomoyo/realpath.c:45 [inline]
 tomoyo_encode+0x26b/0x530 security/tomoyo/realpath.c:80
 tomoyo_realpath_from_path+0x594/0x5d0 security/tomoyo/realpath.c:283
 tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
 tomoyo_check_open_permission+0x240/0x4c0 security/tomoyo/file.c:771
 security_file_open+0x5f/0xa0 security/security.c:1681
 do_dentry_open+0x308/0x10f0 fs/open.c:869
 do_open fs/namei.c:3626 [inline]
 path_openat+0x2644/0x2e60 fs/namei.c:3783
 do_filp_open+0x230/0x480 fs/namei.c:3810
 do_sys_openat2+0x13b/0x4f0 fs/open.c:1318
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1444 [inline]
 free_pcp_prepare mm/page_alloc.c:1494 [inline]
 free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3369
 free_unref_page+0x33/0x3e0 mm/page_alloc.c:3464
 qlink_free mm/kasan/quarantine.c:168 [inline]
 qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x156/0x170 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x1f/0x70 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x52/0x3a0 mm/slab.h:737
 slab_alloc_node mm/slub.c:3398 [inline]
 __kmem_cache_alloc_node+0x137/0x260 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:935 [inline]
 __kmalloc_node+0xa2/0x230 mm/slab_common.c:943
 kmalloc_node include/linux/slab.h:583 [inline]
 kvmalloc_node+0x6e/0x180 mm/util.c:581
 kvmalloc include/linux/slab.h:710 [inline]
 seq_buf_alloc fs/seq_file.c:38 [inline]
 seq_read_iter+0x1fe/0xd10 fs/seq_file.c:210
 call_read_iter include/linux/fs.h:2259 [inline]
 new_sync_read fs/read_write.c:389 [inline]
 vfs_read+0x88d/0xbf0 fs/read_write.c:470
 ksys_read+0x19c/0x2c0 fs/read_write.c:613
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Memory state around the buggy address:
 ffff888029076e80: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff888029076f00: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>ffff888029076f80: 00 00 00 00 00 00 00 00 00 06 fc fc fc fc fc fc
                                              ^
 ffff888029077000: 00 00 00 00 fc fc 00 00 00 00 fc fc 00 00 00 00
 ffff888029077080: fc fc 00 00 00 00 fc fc 00 00 00 00 fc fc 00 00
==================================================================

Crashes (22):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/24 07:46 linux-6.1.y e4d90d63d385 68da6d95 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2023/07/30 13:51 linux-6.1.y d2a6dc4eaf6d 92476829 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2023/06/04 20:19 linux-6.1.y d2869ace6eeb a4ae4f42 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan-arm64 KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/12/18 03:49 linux-6.1.y 52f863f820fd a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/12/18 03:48 linux-6.1.y 52f863f820fd a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/12/13 22:18 linux-6.1.y e4d90d63d385 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/12/13 08:51 linux-6.1.y e4d90d63d385 3547e30f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/12/12 16:14 linux-6.1.y e4d90d63d385 530e80f8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/12/12 16:11 linux-6.1.y e4d90d63d385 530e80f8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/12/12 16:10 linux-6.1.y e4d90d63d385 530e80f8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/12/07 13:08 linux-6.1.y e4d90d63d385 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/12/07 13:08 linux-6.1.y e4d90d63d385 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/11/24 12:29 linux-6.1.y e4d90d63d385 68da6d95 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/11/24 12:29 linux-6.1.y e4d90d63d385 68da6d95 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/11/23 07:39 linux-6.1.y e4d90d63d385 68da6d95 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/11/23 07:39 linux-6.1.y e4d90d63d385 68da6d95 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/12/17 17:01 linux-6.1.y 52f863f820fd f93b2b55 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/12/17 17:01 linux-6.1.y 52f863f820fd f93b2b55 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/12/09 00:54 linux-6.1.y e4d90d63d385 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/12/09 00:52 linux-6.1.y e4d90d63d385 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/12/08 23:35 linux-6.1.y e4d90d63d385 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
2024/12/08 23:35 linux-6.1.y e4d90d63d385 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: slab-out-of-bounds Write in hfs_bnode_read_key
* Struck through repros no longer work on HEAD.