------------[ cut here ]------------ UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dtree.c:2649:28 index -128 is out of range for type 'struct dtslot[128]' CPU: 0 UID: 0 PID: 7388 Comm: syz.3.171 Not tainted 6.14.0-rc1-syzkaller-g2014c95afece #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024 Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:466 (C) __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:120 dump_stack+0x1c/0x28 lib/dump_stack.c:129 ubsan_epilogue lib/ubsan.c:231 [inline] __ubsan_handle_out_of_bounds+0xf8/0x148 lib/ubsan.c:429 add_missing_indices+0x6e4/0xa8c fs/jfs/jfs_dtree.c:2649 jfs_readdir+0x18ac/0x3030 fs/jfs/jfs_dtree.c:3019 wrap_directory_iterator+0xa8/0xf4 fs/readdir.c:65 shared_jfs_readdir+0x30/0x40 fs/jfs/namei.c:1540 iterate_dir+0x46c/0x5f4 fs/readdir.c:108 __do_sys_getdents64 fs/readdir.c:403 [inline] __se_sys_getdents64 fs/readdir.c:389 [inline] __arm64_sys_getdents64+0x1c0/0x490 fs/readdir.c:389 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 ---[ end trace ]--- ================================================================== BUG: KASAN: slab-use-after-free in diWrite+0xb48/0x15cc fs/jfs/jfs_imap.c:753 Write of size 32 at addr ffff0000d6d8f4e0 by task syz.3.171/7388 CPU: 1 UID: 0 PID: 7388 Comm: syz.3.171 Not tainted 6.14.0-rc1-syzkaller-g2014c95afece #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024 Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:466 (C) __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x198/0x538 mm/kasan/report.c:489 kasan_report+0xd8/0x138 mm/kasan/report.c:602 kasan_check_range+0x268/0x2a8 mm/kasan/generic.c:189 __asan_memcpy+0x54/0x84 mm/kasan/shadow.c:106 diWrite+0xb48/0x15cc fs/jfs/jfs_imap.c:753 txCommit+0x750/0x5504 fs/jfs/jfs_txnmgr.c:1255 add_missing_indices+0x760/0xa8c fs/jfs/jfs_dtree.c:2663 jfs_readdir+0x18ac/0x3030 fs/jfs/jfs_dtree.c:3019 wrap_directory_iterator+0xa8/0xf4 fs/readdir.c:65 shared_jfs_readdir+0x30/0x40 fs/jfs/namei.c:1540 iterate_dir+0x46c/0x5f4 fs/readdir.c:108 __do_sys_getdents64 fs/readdir.c:403 [inline] __se_sys_getdents64 fs/readdir.c:389 [inline] __arm64_sys_getdents64+0x1c0/0x490 fs/readdir.c:389 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 Allocated by task 6460: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x40/0x78 mm/kasan/common.c:68 kasan_save_alloc_info+0x40/0x50 mm/kasan/generic.c:562 unpoison_slab_object mm/kasan/common.c:319 [inline] __kasan_slab_alloc+0x74/0x8c mm/kasan/common.c:345 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4115 [inline] slab_alloc_node mm/slub.c:4164 [inline] kmem_cache_alloc_noprof+0x254/0x410 mm/slub.c:4171 vm_area_dup+0x30/0x274 kernel/fork.c:487 dup_mmap kernel/fork.c:694 [inline] dup_mm kernel/fork.c:1700 [inline] copy_mm+0xb04/0x1cc0 kernel/fork.c:1752 copy_process+0x1568/0x3250 kernel/fork.c:2403 kernel_clone+0x1d8/0x82c kernel/fork.c:2815 __do_sys_clone kernel/fork.c:2958 [inline] __se_sys_clone kernel/fork.c:2926 [inline] __arm64_sys_clone+0x1f8/0x24c kernel/fork.c:2926 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 Freed by task 7178: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x40/0x78 mm/kasan/common.c:68 kasan_save_free_info+0x54/0x6c mm/kasan/generic.c:576 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x64/0x8c mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2353 [inline] slab_free mm/slub.c:4609 [inline] kmem_cache_free+0x198/0x554 mm/slub.c:4711 __vm_area_free+0xfc/0x148 kernel/fork.c:515 remove_vma+0x124/0x154 mm/vma.c:417 exit_mmap+0x598/0xda0 mm/mmap.c:1308 __mmput+0xec/0x3dc kernel/fork.c:1356 mmput+0x70/0xac kernel/fork.c:1378 exit_mm+0x148/0x210 kernel/exit.c:570 do_exit+0x46c/0x1acc kernel/exit.c:925 do_group_exit+0x194/0x22c kernel/exit.c:1087 get_signal+0x1418/0x1534 kernel/signal.c:3036 do_signal+0x22c/0x39e4 arch/arm64/kernel/signal.c:1658 do_notify_resume+0x74/0x1f4 arch/arm64/kernel/entry-common.c:148 exit_to_user_mode_prepare arch/arm64/kernel/entry-common.c:169 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:178 [inline] el0_svc+0xac/0x168 arch/arm64/kernel/entry-common.c:745 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 The buggy address belongs to the object at ffff0000d6d8f4d8 which belongs to the cache vm_area_struct of size 184 The buggy address is located 8 bytes inside of freed 184-byte region [ffff0000d6d8f4d8, ffff0000d6d8f590) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x116d8f memcg:ffff0000c6505c01 flags: 0x5ffc00000000000(node=0|zone=2|lastcpupid=0x7ff) page_type: f5(slab) raw: 05ffc00000000000 ffff0000c1897b40 fffffdffc3509040 dead000000000008 raw: 0000000000000000 0000000000100010 00000000f5000000 ffff0000c6505c01 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000d6d8f380: fb fb fb fb fc fc fc fc fc fc fc fc fa fb fb fb ffff0000d6d8f400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff0000d6d8f480: fb fb fb fc fc fc fc fc fc fc fc fa fb fb fb fb ^ ffff0000d6d8f500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000d6d8f580: fb fb fc fc fc fc fc fc fc fc fa fb fb fb fb fb ================================================================== ... Log Wrap ... Log Wrap ... Log Wrap ... ... Log Wrap ... Log Wrap ... Log Wrap ... ... Log Wrap ... Log Wrap ... Log Wrap ... ERROR: (device loop3): jfs_readdir: JFS:Dtree error: ino = 2, bn=0, index = 0 ERROR: (device loop3): remounting filesystem as read-only JFS: Invalid stbl[1] = -128 for inode 2, block = 0