syzbot


KASAN: use-after-free Read in hfsplus_btree_open (2)

Status: upstream: reported on 2025/03/07 16:05
Reported-by: syzbot+4cb8a34aaa8cb484c751@syzkaller.appspotmail.com
First crash: 75d, last: 5d15h
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: use-after-free Read in hfsplus_btree_open 2 590d 662d 0/3 auto-obsoleted due to no activity on 2024/01/17 21:37
linux-5.15 KASAN: use-after-free Read in hfsplus_btree_open 5 543d 785d 0/3 auto-obsoleted due to no activity on 2024/03/04 05:58
linux-6.1 KASAN: use-after-free Read in hfsplus_btree_open (2) 2 474d 484d 0/3 auto-obsoleted due to no activity on 2024/05/12 07:07
linux-6.1 KASAN: use-after-free Read in hfsplus_btree_open (3) 1 272d 272d 0/3 auto-obsoleted due to no activity on 2024/11/30 09:06
upstream KASAN: use-after-free Read in hfsplus_btree_open hfs 8 757d 898d 0/28 auto-obsoleted due to no activity on 2023/08/23 09:08

Sample crash report:
loop2: detected capacity change from 0 to 1024
==================================================================
BUG: KASAN: use-after-free in hfsplus_btree_open+0xb0a/0x11a0 fs/hfsplus/btree.c:155
Read of size 4 at addr ffff888070fb1154 by task syz.2.719/6983

CPU: 1 PID: 6983 Comm: syz.2.719 Not tainted 5.15.182-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/19/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106
 print_address_description+0x60/0x2d0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0xdf/0x130 mm/kasan/report.c:451
 hfsplus_btree_open+0xb0a/0x11a0 fs/hfsplus/btree.c:155
 hfsplus_fill_super+0xab7/0x1b90 fs/hfsplus/super.c:473
 mount_bdev+0x287/0x3c0 fs/super.c:1400
 legacy_get_tree+0xe6/0x180 fs/fs_context.c:611
 vfs_get_tree+0x88/0x270 fs/super.c:1530
 do_new_mount+0x24a/0xa40 fs/namespace.c:3013
 do_mount fs/namespace.c:3356 [inline]
 __do_sys_mount fs/namespace.c:3564 [inline]
 __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3541
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f13c53f710a
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 1a 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f13c325ce68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f13c325cef0 RCX: 00007f13c53f710a
RDX: 0000200000000240 RSI: 0000200000000f80 RDI: 00007f13c325ceb0
RBP: 0000200000000240 R08: 00007f13c325cef0 R09: 0000000000010080
R10: 0000000000010080 R11: 0000000000000246 R12: 0000200000000f80
R13: 00007f13c325ceb0 R14: 00000000000006ac R15: 00002000000004c0
 </TASK>

Allocated by task 4772:
 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_slab_alloc+0x9c/0xd0 mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x4c/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0x100/0x290 mm/slub.c:3233
 f2fs_kmem_cache_alloc fs/f2fs/f2fs.h:2642 [inline]
 f2fs_alloc_inode+0x16c/0x5d0 fs/f2fs/super.c:1396
 alloc_inode fs/inode.c:261 [inline]
 iget_locked+0x191/0x820 fs/inode.c:1308
 f2fs_iget+0x52/0x4920 fs/f2fs/inode.c:498
 f2fs_fill_super+0x3c76/0x6f00 fs/f2fs/super.c:4164
 mount_bdev+0x287/0x3c0 fs/super.c:1400
 legacy_get_tree+0xe6/0x180 fs/fs_context.c:611
 vfs_get_tree+0x88/0x270 fs/super.c:1530
 do_new_mount+0x24a/0xa40 fs/namespace.c:3013
 do_mount fs/namespace.c:3356 [inline]
 __do_sys_mount fs/namespace.c:3564 [inline]
 __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3541
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Last potentially related work creation:
 kasan_save_stack+0x35/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xb8/0x100 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:3007 [inline]
 call_rcu+0x179/0x920 kernel/rcu/tree.c:3087
 destroy_inode fs/inode.c:316 [inline]
 evict+0x7da/0x870 fs/inode.c:662
 f2fs_fill_super+0x56bb/0x6f00 fs/f2fs/super.c:4473
 mount_bdev+0x287/0x3c0 fs/super.c:1400
 legacy_get_tree+0xe6/0x180 fs/fs_context.c:611
 vfs_get_tree+0x88/0x270 fs/super.c:1530
 do_new_mount+0x24a/0xa40 fs/namespace.c:3013
 do_mount fs/namespace.c:3356 [inline]
 __do_sys_mount fs/namespace.c:3564 [inline]
 __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3541
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Second to last potentially related work creation:
 kasan_save_stack+0x35/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xb8/0x100 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:3007 [inline]
 call_rcu+0x179/0x920 kernel/rcu/tree.c:3087
 destroy_inode fs/inode.c:316 [inline]
 evict+0x7da/0x870 fs/inode.c:662
 f2fs_fill_super+0x55e5/0x6f00 fs/f2fs/super.c:4455
 mount_bdev+0x287/0x3c0 fs/super.c:1400
 legacy_get_tree+0xe6/0x180 fs/fs_context.c:611
 vfs_get_tree+0x88/0x270 fs/super.c:1530
 do_new_mount+0x24a/0xa40 fs/namespace.c:3013
 do_mount fs/namespace.c:3356 [inline]
 __do_sys_mount fs/namespace.c:3564 [inline]
 __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3541
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff888070fb0980
 which belongs to the cache f2fs_inode_cache of size 2304
The buggy address is located 2004 bytes inside of
 2304-byte region [ffff888070fb0980, ffff888070fb1280)
The buggy address belongs to the page:
page:ffffea0001c3ec00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888070fb4280 pfn:0x70fb0
head:ffffea0001c3ec00 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff888022dab501
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff88801dbe0140
raw: ffff888070fb4280 00000000800d0004 00000001ffffffff ffff888022dab501
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Reclaimable, gfp_mask 0x1d2050(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 4435, ts 94660887595, free_ts 89074552970
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x1b77/0x1c60 mm/page_alloc.c:4192
 __alloc_pages+0x1e1/0x470 mm/page_alloc.c:5466
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xc0/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x81e/0xdf0 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]
 kmem_cache_alloc+0x195/0x290 mm/slub.c:3233
 f2fs_kmem_cache_alloc fs/f2fs/f2fs.h:2642 [inline]
 f2fs_alloc_inode+0x16c/0x5d0 fs/f2fs/super.c:1396
 alloc_inode fs/inode.c:261 [inline]
 iget_locked+0x191/0x820 fs/inode.c:1308
 f2fs_iget+0x52/0x4920 fs/f2fs/inode.c:498
 f2fs_fill_super+0x3c76/0x6f00 fs/f2fs/super.c:4164
 mount_bdev+0x287/0x3c0 fs/super.c:1400
 legacy_get_tree+0xe6/0x180 fs/fs_context.c:611
 vfs_get_tree+0x88/0x270 fs/super.c:1530
 do_new_mount+0x24a/0xa40 fs/namespace.c:3013
 do_mount fs/namespace.c:3356 [inline]
 __do_sys_mount fs/namespace.c:3564 [inline]
 __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3541
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
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+0x637/0x6c0 mm/page_alloc.c:3317
 free_unref_page+0x94/0x280 mm/page_alloc.c:3396
 free_slab mm/slub.c:2015 [inline]
 discard_slab mm/slub.c:2021 [inline]
 __unfreeze_partials+0x1a5/0x200 mm/slub.c:2507
 put_cpu_partial+0x12d/0x190 mm/slub.c:2587
 qlist_free_all+0x35/0x90 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x150/0x160 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xd0 mm/kasan/common.c:444
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x4c/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0x100/0x290 mm/slub.c:3233
 getname_flags+0xb5/0x500 fs/namei.c:138
 user_path_at_empty+0x2a/0x190 fs/namei.c:2882
 do_readlinkat+0xd4/0x480 fs/stat.c:442
 __do_sys_readlink fs/stat.c:475 [inline]
 __se_sys_readlink fs/stat.c:472 [inline]
 __x64_sys_readlink+0x7b/0x90 fs/stat.c:472
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Memory state around the buggy address:
 ffff888070fb1000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888070fb1080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888070fb1100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff888070fb1180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888070fb1200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/05/16 11:56 linux-5.15.y 3b8db0e4f263 cfde8269 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in hfsplus_btree_open
2025/03/07 16:04 linux-5.15.y c16c81c81336 7e3bd60d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in hfsplus_btree_open
* Struck through repros no longer work on HEAD.