syzbot has found a reproducer for the following issue on:
HEAD commit: fa74641fb6b9 Linux 6.1.29
git tree: linux-6.1.y
console output:
https://syzkaller.appspot.com/x/log.txt?x=14a71451280000
kernel config:
https://syzkaller.appspot.com/x/.config?x=7454aa89ac475d7b
syz repro:
https://syzkaller.appspot.com/x/repro.syz?x=136b80c1280000
C reproducer:
https://syzkaller.appspot.com/x/repro.c?x=1143596a280000
Downloadable assets:
disk image:
https://storage.googleapis.com/syzbot-assets/53e4da6b145c/disk-fa74641f.raw.xz
vmlinux:
https://storage.googleapis.com/syzbot-assets/adeb1a2cfa86/vmlinux-fa74641f.xz
kernel image:
https://storage.googleapis.com/syzbot-assets/c976f1155d08/Image-fa74641f.gz.xz
mounted in repro:
https://storage.googleapis.com/syzbot-assets/3d856f9d09f0/mount_0.gz
loop0: detected capacity change from 0 to 14901
read_mapping_page failed!
jfs_mount: diMount failed w/rc = -5
==================================================================
BUG: KASAN: use-after-free in diFree+0x17ac/0x2648 fs/jfs/jfs_imap.c:871
Read of size 4 at addr ffff0000d8130004 by task syz-executor453/4290
CPU: 0 PID: 4290 Comm: syz-executor453 Not tainted 6.1.29-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023
Allocated by task 3840:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383
kasan_kmalloc include/linux/kasan.h:211 [inline]
__do_kmalloc_node mm/slab_common.c:955 [inline]
__kmalloc+0xd8/0x1c4 mm/slab_common.c:968
kmalloc include/linux/slab.h:558 [inline]
tomoyo_realpath_from_path+0xc8/0x4cc security/tomoyo/realpath.c:251
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_perm+0x208/0x568 security/tomoyo/file.c:822
tomoyo_inode_getattr+0x28/0x38 security/tomoyo/tomoyo.c:122
security_inode_getattr+0xd8/0x124 security/security.c:1347
vfs_getattr fs/stat.c:158 [inline]
vfs_statx+0x184/0x420 fs/stat.c:233
vfs_fstatat fs/stat.c:267 [inline]
__do_sys_newfstatat fs/stat.c:437 [inline]
__se_sys_newfstatat fs/stat.c:431 [inline]
__arm64_sys_newfstatat+0x134/0x1c0 fs/stat.c:431
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
Freed by task 3840:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:516
____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236
__kasan_slab_free+0x18/0x28 mm/kasan/common.c:244
kasan_slab_free include/linux/kasan.h:177 [inline]
slab_free_hook mm/slub.c:1724 [inline]
slab_free_freelist_hook mm/slub.c:1750 [inline]
slab_free mm/slub.c:3661 [inline]
__kmem_cache_free+0x2c0/0x4b4 mm/slub.c:3674
kfree+0xcc/0x1b8 mm/slab_common.c:1007
tomoyo_realpath_from_path+0x484/0x4cc security/tomoyo/realpath.c:286
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_perm+0x208/0x568 security/tomoyo/file.c:822
tomoyo_inode_getattr+0x28/0x38 security/tomoyo/tomoyo.c:122
security_inode_getattr+0xd8/0x124 security/security.c:1347
vfs_getattr fs/stat.c:158 [inline]
vfs_statx+0x184/0x420 fs/stat.c:233
vfs_fstatat fs/stat.c:267 [inline]
__do_sys_newfstatat fs/stat.c:437 [inline]
__se_sys_newfstatat fs/stat.c:431 [inline]
__arm64_sys_newfstatat+0x134/0x1c0 fs/stat.c:431
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
The buggy address belongs to the object at ffff0000d8130000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 4 bytes inside of
4096-byte region [ffff0000d8130000, ffff0000d8131000)
The buggy address belongs to the physical page:
page:00000000896df55b refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x118130
head:00000000896df55b order:3 compound_mapcount:0 compound_pincount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 fffffc000354b800 dead000000000003 ffff0000c0002a80
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff0000d812ff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff0000d812ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000d8130000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff0000d8130080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000d8130100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
imap: 00000000d883ed5a: c7481500 ffff0000 00000f00 06600263
imap: 000000001ff316ea: 00000000 00000000 00000000 00000000
ERROR: (device loop0): diFree: inum = 2, iagno = 0, nextiag = -65536
Mount JFS Failure: -5
jfs_mount failed w/return code = -5
---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.