syzbot


KASAN: use-after-free Read in diAllocAG

Status: moderation: reported on 2025/08/11 03:03
Subsystems: jfs
[Documentation on labels]
Reported-by: syzbot+e01b9d304393aa8a5282@syzkaller.appspotmail.com
First crash: 17d, last: 17d

Sample crash report:
syz.0.0: attempt to access beyond end of device
loop0: rw=1, sector=360, nr_sectors = 8 limit=0
metapage_write_end_io: I/O error
ERROR: (device loop0): release_metapage: metapage_write_one() failed
Buffer I/O error on dev loop0, logical block 8, lost sync page write
ERROR: (device loop0): remounting filesystem as read-only
lbmIODone: I/O error in JFS log
metapage_write_end_io: I/O error
ERROR: (device loop0): force_metapage: metapage_write_one() failed
Read error 10 at 0x1a000
read_mapping_page failed!
Buffer I/O error on dev loop0, logical block 15, lost sync page write
metapage_write_end_io: I/O error
Read error 10 at 0xd000
read_mapping_page failed!
diWriteSpecial: failed to read aggregate inode extent!
==================================================================
BUG: KASAN: use-after-free in diIAGRead fs/jfs/jfs_imap.c:2665 [inline]
BUG: KASAN: use-after-free in diNewIAG fs/jfs/jfs_imap.c:2620 [inline]
BUG: KASAN: use-after-free in diAllocExt fs/jfs/jfs_imap.c:1905 [inline]
BUG: KASAN: use-after-free in diAllocAG+0x7c1/0x1df0 fs/jfs/jfs_imap.c:1669
Read of size 8 at addr ffff888033128820 by task syz.0.0/5354

CPU: 0 UID: 0 PID: 5354 Comm: syz.0.0 Not tainted 6.16.0-syzkaller-11895-gcca7a0aae895 #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:378 [inline]
 print_report+0xca/0x240 mm/kasan/report.c:482
 kasan_report+0x118/0x150 mm/kasan/report.c:595
 diIAGRead fs/jfs/jfs_imap.c:2665 [inline]
 diNewIAG fs/jfs/jfs_imap.c:2620 [inline]
 diAllocExt fs/jfs/jfs_imap.c:1905 [inline]
 diAllocAG+0x7c1/0x1df0 fs/jfs/jfs_imap.c:1669
 diAlloc+0x1d5/0x1680 fs/jfs/jfs_imap.c:1590
 ialloc+0x8c/0x8f0 fs/jfs/jfs_inode.c:56
 jfs_mkdir+0x193/0xa70 fs/jfs/namei.c:225
 vfs_mkdir+0x303/0x510 fs/namei.c:4366
 do_mkdirat+0x247/0x590 fs/namei.c:4399
 __do_sys_mkdirat fs/namei.c:4416 [inline]
 __se_sys_mkdirat fs/namei.c:4414 [inline]
 __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:4414
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f09e118ebe9
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:00007f09dd5d4038 EFLAGS: 00000246 ORIG_RAX: 0000000000000102
RAX: ffffffffffffffda RBX: 00007f09e13b6090 RCX: 00007f09e118ebe9
RDX: 0000000000000089 RSI: 0000200000000280 RDI: ffffffffffffff9c
RBP: 00007f09e1211e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f09e13b6128 R14: 00007f09e13b6090 R15: 00007ffeaf568e88
 </TASK>

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888033128000 pfn:0x33128
flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff)
raw: 04fff00000000000 ffffea000110a408 ffff88801fc3ff70 0000000000000000
raw: ffff888033128000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x40dc0(GFP_KERNEL|__GFP_ZERO|__GFP_COMP), pid 5353, tgid 5352 (syz.0.0), ts 76273309822, free_ts 76279278909
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1851
 prep_new_page mm/page_alloc.c:1859 [inline]
 get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3858
 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5148
 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2416
 ___kmalloc_large_node+0x5f/0x1b0 mm/slub.c:4306
 __kmalloc_large_noprof+0x1a/0x90 mm/slub.c:4327
 kmalloc_noprof include/linux/slab.h:902 [inline]
 kzalloc_noprof include/linux/slab.h:1039 [inline]
 diMount+0x29/0xd80 fs/jfs/jfs_imap.c:105
 jfs_mount_rw+0x302/0x670 fs/jfs/jfs_mount.c:240
 jfs_reconfigure+0x5f9/0xa00 fs/jfs/super.c:409
 reconfigure_super+0x227/0x890 fs/super.c:1077
 vfs_cmd_reconfigure fs/fsopen.c:262 [inline]
 vfs_fsconfig_locked+0x171/0x320 fs/fsopen.c:291
 __do_sys_fsconfig fs/fsopen.c:467 [inline]
 __se_sys_fsconfig+0x78e/0x8d0 fs/fsopen.c:344
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 5353 tgid 5352 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1395 [inline]
 __free_frozen_pages+0xbc4/0xd30 mm/page_alloc.c:2895
 free_large_kmalloc+0x13a/0x1f0 mm/slub.c:4805
 diMount+0xbc5/0xd80 fs/jfs/jfs_imap.c:115
 jfs_mount_rw+0x302/0x670 fs/jfs/jfs_mount.c:240
 jfs_reconfigure+0x5f9/0xa00 fs/jfs/super.c:409
 reconfigure_super+0x227/0x890 fs/super.c:1077
 vfs_cmd_reconfigure fs/fsopen.c:262 [inline]
 vfs_fsconfig_locked+0x171/0x320 fs/fsopen.c:291
 __do_sys_fsconfig fs/fsopen.c:467 [inline]
 __se_sys_fsconfig+0x78e/0x8d0 fs/fsopen.c:344
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Memory state around the buggy address:
 ffff888033128700: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888033128780: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888033128800: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                               ^
 ffff888033128880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888033128900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/08/07 02:50 upstream cca7a0aae895 9a42d6b1 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: use-after-free Read in diAllocAG
* Struck through repros no longer work on HEAD.