hfsplus: request for non-existent node 128 in B*Tree hfsplus: request for non-existent node 128 in B*Tree ================================================================== BUG: KASAN: slab-out-of-bounds in hfsplus_bnode_read+0x85/0x1c0 fs/hfsplus/bnode.c:32 Read of size 8 at addr ffff8880605d35c0 by task syz.2.951/7096 CPU: 0 PID: 7096 Comm: syz.2.951 Not tainted 5.15.164-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 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 hfsplus_bnode_read+0x85/0x1c0 fs/hfsplus/bnode.c:32 hfsplus_bnode_read_u16 fs/hfsplus/bnode.c:47 [inline] hfsplus_bnode_dump+0x3f7/0x7c0 fs/hfsplus/bnode.c:328 hfsplus_brec_remove+0x428/0x4e0 fs/hfsplus/brec.c:229 __hfsplus_delete_attr+0x271/0x450 fs/hfsplus/attributes.c:299 hfsplus_delete_all_attrs+0x267/0x3c0 fs/hfsplus/attributes.c:378 hfsplus_delete_cat+0xb83/0xfb0 fs/hfsplus/catalog.c:425 hfsplus_unlink+0x35f/0x7f0 fs/hfsplus/dir.c:385 vfs_unlink+0x359/0x5f0 fs/namei.c:4280 do_unlinkat+0x4a3/0x950 fs/namei.c:4348 __do_sys_unlinkat fs/namei.c:4391 [inline] __se_sys_unlinkat fs/namei.c:4384 [inline] __x64_sys_unlinkat+0xca/0xf0 fs/namei.c:4384 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7f73413433b9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f733f7a1048 EFLAGS: 00000246 ORIG_RAX: 0000000000000107 RAX: ffffffffffffffda RBX: 00007f73414d2058 RCX: 00007f73413433b9 RDX: 0000000000000000 RSI: 0000000020000380 RDI: ffffffffffffff9c RBP: 00007f73413b08e6 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000006e R14: 00007f73414d2058 R15: 00007fff4fc67488 Allocated by task 7096: 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] kzalloc include/linux/slab.h:721 [inline] __hfs_bnode_create+0xf9/0xbb0 fs/hfsplus/bnode.c:416 hfsplus_bnode_find+0x22e/0xe80 fs/hfsplus/bnode.c:497 hfsplus_brec_find+0x17f/0x570 fs/hfsplus/bfind.c:183 hfsplus_find_attr fs/hfsplus/attributes.c:160 [inline] hfsplus_delete_all_attrs+0x23e/0x3c0 fs/hfsplus/attributes.c:371 hfsplus_delete_cat+0xb83/0xfb0 fs/hfsplus/catalog.c:425 hfsplus_unlink+0x35f/0x7f0 fs/hfsplus/dir.c:385 vfs_unlink+0x359/0x5f0 fs/namei.c:4280 do_unlinkat+0x4a3/0x950 fs/namei.c:4348 __do_sys_unlinkat fs/namei.c:4391 [inline] __se_sys_unlinkat fs/namei.c:4384 [inline] __x64_sys_unlinkat+0xca/0xf0 fs/namei.c:4384 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 Last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348 insert_work+0x54/0x3e0 kernel/workqueue.c:1366 __queue_work+0x963/0xd00 kernel/workqueue.c:1532 queue_work_on+0x14b/0x250 kernel/workqueue.c:1559 queue_work include/linux/workqueue.h:512 [inline] loop_queue_work drivers/block/loop.c:1067 [inline] loop_queue_rq+0x9ed/0xae0 drivers/block/loop.c:2201 __blk_mq_issue_directly block/blk-mq.c:2008 [inline] __blk_mq_try_issue_directly+0x541/0x8b0 block/blk-mq.c:2064 blk_mq_try_issue_directly+0x116/0x370 block/blk-mq.c:2095 blk_mq_submit_bio+0x11bb/0x1c40 block/blk-mq.c:2317 __submit_bio+0x813/0x850 block/blk-core.c:917 __submit_bio_noacct_mq block/blk-core.c:997 [inline] submit_bio_noacct+0x955/0xb30 block/blk-core.c:1027 submit_bio+0x2dd/0x560 block/blk-core.c:1089 submit_bh fs/buffer.c:3062 [inline] __sync_dirty_buffer+0x245/0x380 fs/buffer.c:3157 fat_set_state+0x278/0x360 fs/fat/inode.c:709 fat_put_super+0x44/0xb0 fs/fat/inode.c:735 generic_shutdown_super+0x136/0x2c0 fs/super.c:475 kill_block_super+0x7a/0xe0 fs/super.c:1414 deactivate_locked_super+0xa0/0x110 fs/super.c:335 cleanup_mnt+0x44e/0x500 fs/namespace.c:1143 task_work_run+0x129/0x1a0 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:181 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline] syscall_exit_to_user_mode+0x5d/0x240 kernel/entry/common.c:307 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x66/0xd0 Second to last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348 insert_work+0x54/0x3e0 kernel/workqueue.c:1366 __queue_work+0x963/0xd00 kernel/workqueue.c:1532 queue_work_on+0x14b/0x250 kernel/workqueue.c:1559 queue_work include/linux/workqueue.h:512 [inline] loop_queue_work drivers/block/loop.c:1067 [inline] loop_queue_rq+0x9ed/0xae0 drivers/block/loop.c:2201 __blk_mq_issue_directly block/blk-mq.c:2008 [inline] __blk_mq_try_issue_directly+0x541/0x8b0 block/blk-mq.c:2064 blk_mq_try_issue_directly+0x116/0x370 block/blk-mq.c:2095 blk_mq_submit_bio+0x11bb/0x1c40 block/blk-mq.c:2317 __submit_bio+0x813/0x850 block/blk-core.c:917 __submit_bio_noacct_mq block/blk-core.c:997 [inline] submit_bio_noacct+0x955/0xb30 block/blk-core.c:1027 submit_bio+0x2dd/0x560 block/blk-core.c:1089 ll_rw_block+0x1cf/0x230 __breadahead+0xbe/0x170 fs/buffer.c:1348 sb_breadahead include/linux/buffer_head.h:349 [inline] fat_dir_readahead fs/fat/dir.c:67 [inline] fat__get_entry fs/fat/dir.c:98 [inline] fat_get_entry+0x65f/0xaa0 fs/fat/dir.c:128 fat_get_short_entry fs/fat/dir.c:873 [inline] fat_subdirs+0x12e/0x3c0 fs/fat/dir.c:939 fat_fill_inode+0xe6b/0x1590 fs/fat/inode.c:540 fat_build_inode+0x28a/0x3c0 fs/fat/inode.c:608 vfat_lookup+0x36d/0x5d0 fs/fat/namei_vfat.c:721 lookup_one_qstr_excl+0x117/0x240 fs/namei.c:1563 filename_create+0x293/0x530 fs/namei.c:3836 do_mkdirat+0xb3/0x520 fs/namei.c:4080 __do_sys_mkdir fs/namei.c:4110 [inline] __se_sys_mkdir fs/namei.c:4108 [inline] __x64_sys_mkdir+0x6a/0x80 fs/namei.c:4108 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 The buggy address belongs to the object at ffff8880605d3500 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 0 bytes to the right of 192-byte region [ffff8880605d3500, ffff8880605d35c0) The buggy address belongs to the page: page:ffffea00018174c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x605d3 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 dead000000000100 dead000000000122 ffff888011c41a00 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 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 5781, ts 208877399414, free_ts 208877221643 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:5423 __alloc_pages_node include/linux/gfp.h:570 [inline] alloc_slab_page mm/slub.c:1777 [inline] allocate_slab mm/slub.c:1912 [inline] new_slab+0xb1/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] __kmalloc_node+0x1fa/0x390 mm/slub.c:4451 kmalloc_array_node include/linux/slab.h:684 [inline] kcalloc_node include/linux/slab.h:689 [inline] memcg_alloc_page_obj_cgroups+0x7e/0x120 mm/memcontrol.c:2836 account_slab_page mm/slab.h:424 [inline] allocate_slab mm/slub.c:1928 [inline] new_slab+0xfb/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] kmem_cache_alloc+0x18e/0x280 mm/slub.c:3233 sock_alloc_inode+0x17/0xb0 net/socket.c:303 alloc_inode fs/inode.c:236 [inline] new_inode_pseudo+0x60/0x210 fs/inode.c:937 sock_alloc net/socket.c:626 [inline] __sock_create+0x11f/0x8d0 net/socket.c:1450 sock_create net/socket.c:1537 [inline] __sys_socket+0x132/0x370 net/socket.c:1579 __do_sys_socket net/socket.c:1588 [inline] __se_sys_socket net/socket.c:1586 [inline] __x64_sys_socket+0x76/0x80 net/socket.c:1586 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 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+0xc34/0xcf0 mm/page_alloc.c:3317 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396 __vunmap+0x8d4/0xa20 mm/vmalloc.c:2621 copy_entries_to_user net/ipv4/netfilter/arp_tables.c:712 [inline] get_entries net/ipv4/netfilter/arp_tables.c:866 [inline] do_arpt_get_ctl+0x1098/0x1680 net/ipv4/netfilter/arp_tables.c:1460 nf_getsockopt+0x28e/0x2b0 net/netfilter/nf_sockopt.c:116 ip_getsockopt+0x15be/0x2450 net/ipv4/ip_sockglue.c:1797 tcp_getsockopt+0x25a/0x6fe0 net/ipv4/tcp.c:4312 __sys_getsockopt+0x2a6/0x550 net/socket.c:2242 __do_sys_getsockopt net/socket.c:2257 [inline] __se_sys_getsockopt net/socket.c:2254 [inline] __x64_sys_getsockopt+0xb1/0xc0 net/socket.c:2254 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 Memory state around the buggy address: ffff8880605d3480: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff8880605d3500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff8880605d3580: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff8880605d3600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880605d3680: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================