================================================================== BUG: KASAN: use-after-free in diWrite+0xb48/0x1604 fs/jfs/jfs_imap.c:753 Write of size 32 at addr ffff0000cab75200 by task syz.1.339/6120 CPU: 1 PID: 6120 Comm: syz.1.339 Not tainted 5.15.173-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call trace: dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106 print_address_description+0x7c/0x3f0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:434 [inline] kasan_report+0x174/0x1e4 mm/kasan/report.c:451 kasan_check_range+0x274/0x2b4 mm/kasan/generic.c:189 memcpy+0xb4/0xe8 mm/kasan/shadow.c:66 diWrite+0xb48/0x1604 fs/jfs/jfs_imap.c:753 txCommit+0x754/0x55b0 fs/jfs/jfs_txnmgr.c:1255 add_missing_indices fs/jfs/jfs_dtree.c:2959 [inline] jfs_readdir+0x1fd0/0x385c fs/jfs/jfs_dtree.c:3307 iterate_dir+0x1f4/0x4ec __do_sys_getdents64 fs/readdir.c:369 [inline] __se_sys_getdents64 fs/readdir.c:354 [inline] __arm64_sys_getdents64+0x1c4/0x4c4 fs/readdir.c:354 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 Allocated by task 5850: 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+0xbc/0xfc mm/kasan/common.c:513 __kasan_kmalloc+0x10/0x1c mm/kasan/common.c:522 kasan_kmalloc include/linux/kasan.h:264 [inline] __kmalloc+0x29c/0x4c8 mm/slub.c:4407 kmalloc include/linux/slab.h:596 [inline] kzalloc include/linux/slab.h:721 [inline] tomoyo_encode2 security/tomoyo/realpath.c:45 [inline] tomoyo_encode+0x270/0x4b0 security/tomoyo/realpath.c:80 tomoyo_realpath_from_path+0x4b4/0x508 security/tomoyo/realpath.c:288 tomoyo_mount_acl security/tomoyo/mount.c:105 [inline] tomoyo_mount_permission+0x2d0/0x8b4 security/tomoyo/mount.c:237 tomoyo_sb_mount+0x48/0x60 security/tomoyo/tomoyo.c:392 security_sb_mount+0x94/0xd4 security/security.c:978 path_mount+0xb8/0x101c fs/namespace.c:3284 do_mount fs/namespace.c:3355 [inline] __do_sys_mount fs/namespace.c:3563 [inline] __se_sys_mount fs/namespace.c:3540 [inline] __arm64_sys_mount+0x510/0x5e0 fs/namespace.c:3540 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 The buggy address belongs to the object at ffff0000cab75200 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 0 bytes inside of 128-byte region [ffff0000cab75200, ffff0000cab75280) The buggy address belongs to the page: page:0000000057d2bbba refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff0000cab75e00 pfn:0x10ab75 flags: 0x5ffc00000000200(slab|node=0|zone=2|lastcpupid=0x7ff) raw: 05ffc00000000200 fffffc00033b07c8 fffffc000317f108 ffff0000c0002300 raw: ffff0000cab75e00 0000000000100007 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000cab75100: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc ffff0000cab75180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff0000cab75200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff0000cab75280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff0000cab75300: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ERROR: (device loop1): jfs_readdir: JFS:Dtree error: ino = 2, bn=0, index = 0 ERROR: (device loop1): remounting filesystem as read-only