[v6.6] KASAN: slab-use-after-free Read in gfs2_invalidate_folio

2 views
Skip to first unread message

syzbot

unread,
Aug 3, 2025, 8:39:27 PM8/3/25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 3a8ababb8b6a Linux 6.6.101
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1649fcf0580000
kernel config: https://syzkaller.appspot.com/x/.config?x=a2bd95b6de4839b7
dashboard link: https://syzkaller.appspot.com/bug?extid=3e3a6a1d24303b7797e2
compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/f06c672f5fa8/disk-3a8ababb.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/9af9b7afcdc5/vmlinux-3a8ababb.xz
kernel image: https://storage.googleapis.com/syzbot-assets/351a55aafa77/bzImage-3a8ababb.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+3e3a6a...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: slab-use-after-free in list_empty include/linux/list.h:373 [inline]
BUG: KASAN: slab-use-after-free in gfs2_discard fs/gfs2/aops.c:622 [inline]
BUG: KASAN: slab-use-after-free in gfs2_invalidate_folio+0x463/0xa50 fs/gfs2/aops.c:660
Read of size 8 at addr ffff88805b4a8248 by task syz.2.5535/25742

CPU: 1 PID: 25742 Comm: syz.2.5535 Not tainted 6.6.101-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
<TASK>
dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:364 [inline]
print_report+0xac/0x220 mm/kasan/report.c:468
kasan_report+0x117/0x150 mm/kasan/report.c:581
list_empty include/linux/list.h:373 [inline]
gfs2_discard fs/gfs2/aops.c:622 [inline]
gfs2_invalidate_folio+0x463/0xa50 fs/gfs2/aops.c:660
folio_invalidate mm/truncate.c:158 [inline]
truncate_cleanup_folio+0x220/0x5c0 mm/truncate.c:178
truncate_inode_pages_range+0x229/0xf00 mm/truncate.c:367
gfs2_evict_inode+0x3d8/0x1220 fs/gfs2/super.c:1537
evict+0x486/0x870 fs/inode.c:705
gfs2_evict_inodes fs/gfs2/ops_fstype.c:1770 [inline]
gfs2_kill_sb+0x230/0x320 fs/gfs2/ops_fstype.c:1796
deactivate_locked_super+0x97/0x100 fs/super.c:481
cleanup_mnt+0x429/0x4c0 fs/namespace.c:1250
task_work_run+0x1ce/0x250 kernel/task_work.c:239
exit_task_work include/linux/task_work.h:43 [inline]
do_exit+0x90b/0x23c0 kernel/exit.c:883
do_group_exit+0x21b/0x2d0 kernel/exit.c:1024
get_signal+0x12fc/0x1400 kernel/signal.c:2902
arch_do_signal_or_restart+0x96/0x780 arch/x86/kernel/signal.c:310
exit_to_user_mode_loop+0x70/0x110 kernel/entry/common.c:174
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210
__syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline]
syscall_exit_to_user_mode+0x1a/0x50 kernel/entry/common.c:302
do_syscall_64+0x61/0xb0 arch/x86/entry/common.c:87
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f8f597c1425
Code: Unable to access opcode bytes at 0x7f8f597c13fb.
RSP: 002b:00007f8f5a64af80 EFLAGS: 00000293 ORIG_RAX: 00000000000000e6
RAX: fffffffffffffdfc RBX: 00007f8f599b6160 RCX: 00007f8f597c1425
RDX: 00007f8f5a64afc0 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 00007f8f59811df1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f8f599b6160 R15: 00007ffe8b974038
</TASK>

Allocated by task 26162:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4e/0x70 mm/kasan/common.c:52
__kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:328
kasan_slab_alloc include/linux/kasan.h:188 [inline]
slab_post_alloc_hook+0x6e/0x4d0 mm/slab.h:767
slab_alloc_node mm/slub.c:3485 [inline]
slab_alloc mm/slub.c:3493 [inline]
__kmem_cache_alloc_lru mm/slub.c:3500 [inline]
kmem_cache_alloc+0x11e/0x2e0 mm/slub.c:3509
kmem_cache_zalloc include/linux/slab.h:711 [inline]
gfs2_alloc_bufdata fs/gfs2/trans.c:168 [inline]
gfs2_trans_add_data+0x1ff/0x620 fs/gfs2/trans.c:209
gfs2_trans_add_databufs+0x15a/0x1c0 fs/gfs2/aops.c:57
gfs2_iomap_put_folio+0x1be/0x400 fs/gfs2/bmap.c:988
iomap_write_end+0x631/0xb90 fs/iomap/buffered-io.c:860
iomap_write_iter fs/iomap/buffered-io.c:926 [inline]
iomap_file_buffered_write+0x710/0xd10 fs/iomap/buffered-io.c:975
gfs2_file_buffered_write+0x4bd/0x820 fs/gfs2/file.c:1060
gfs2_file_write_iter+0x427/0xe10 fs/gfs2/file.c:1158
call_write_iter include/linux/fs.h:2018 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x43b/0x940 fs/read_write.c:584
ksys_write+0x147/0x250 fs/read_write.c:637
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 26162:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4e/0x70 mm/kasan/common.c:52
kasan_save_free_info+0x2e/0x50 mm/kasan/generic.c:522
____kasan_slab_free+0x126/0x1e0 mm/kasan/common.c:236
kasan_slab_free include/linux/kasan.h:164 [inline]
slab_free_hook mm/slub.c:1806 [inline]
slab_free_freelist_hook+0x130/0x1b0 mm/slub.c:1832
slab_free mm/slub.c:3816 [inline]
kmem_cache_free+0xf8/0x280 mm/slub.c:3838
trans_drain fs/gfs2/log.c:1022 [inline]
gfs2_log_flush+0x18d1/0x24b0 fs/gfs2/log.c:1162
gfs2_jdata_writepages+0xf9/0x150 fs/gfs2/aops.c:398
do_writepages+0x3a2/0x600 mm/page-writeback.c:2575
filemap_fdatawrite_wbc+0x122/0x180 mm/filemap.c:390
__filemap_fdatawrite_range mm/filemap.c:423 [inline]
filemap_fdatawrite_range+0xce/0x120 mm/filemap.c:441
gfs2_fsync+0xdf/0x350 fs/gfs2/file.c:751
generic_write_sync include/linux/fs.h:2651 [inline]
gfs2_file_write_iter+0xc72/0xe10 fs/gfs2/file.c:1160
do_iter_readv_writev fs/read_write.c:-1 [inline]
do_iter_write+0x79a/0xc70 fs/read_write.c:860
vfs_writev fs/read_write.c:933 [inline]
do_writev+0x252/0x410 fs/read_write.c:976
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff88805b4a8230
which belongs to the cache gfs2_bufdata of size 80
The buggy address is located 24 bytes inside of
freed 80-byte region [ffff88805b4a8230, ffff88805b4a8280)

The buggy address belongs to the physical page:
page:ffffea00016d2a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5b4a8
flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000800 ffff8881442dd140 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000240024 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 0x112c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 26162, tgid 26161 (syz.2.5640), ts 2202792462719, free_ts 2200945524094
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x1cd/0x210 mm/page_alloc.c:1554
prep_new_page mm/page_alloc.c:1561 [inline]
get_page_from_freelist+0x195c/0x19f0 mm/page_alloc.c:3191
__alloc_pages+0x1e3/0x460 mm/page_alloc.c:4457
alloc_slab_page+0x5d/0x170 mm/slub.c:1876
allocate_slab mm/slub.c:2023 [inline]
new_slab+0x87/0x2e0 mm/slub.c:2076
___slab_alloc+0xc6d/0x12f0 mm/slub.c:3230
__slab_alloc mm/slub.c:3329 [inline]
__slab_alloc_node mm/slub.c:3382 [inline]
slab_alloc_node mm/slub.c:3475 [inline]
slab_alloc mm/slub.c:3493 [inline]
__kmem_cache_alloc_lru mm/slub.c:3500 [inline]
kmem_cache_alloc+0x1b7/0x2e0 mm/slub.c:3509
kmem_cache_zalloc include/linux/slab.h:711 [inline]
gfs2_alloc_bufdata fs/gfs2/trans.c:168 [inline]
gfs2_trans_add_meta+0x30c/0xc20 fs/gfs2/trans.c:251
do_gfs2_set_flags fs/gfs2/file.c:265 [inline]
gfs2_fileattr_set+0x77d/0x9b0 fs/gfs2/file.c:311
vfs_fileattr_set+0x846/0xaf0 fs/ioctl.c:697
ioctl_setflags fs/ioctl.c:729 [inline]
do_vfs_ioctl+0x135a/0x1bb0 fs/ioctl.c:840
__do_sys_ioctl fs/ioctl.c:869 [inline]
__se_sys_ioctl+0x83/0x170 fs/ioctl.c:857
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1154 [inline]
free_unref_page_prepare+0x7ce/0x8e0 mm/page_alloc.c:2336
free_unref_page+0x32/0x2e0 mm/page_alloc.c:2429
vfree+0x1a6/0x320 mm/vmalloc.c:2868
kcov_put kernel/kcov.c:438 [inline]
kcov_close+0x2b/0x50 kernel/kcov.c:534
__fput+0x234/0x970 fs/file_table.c:384
task_work_run+0x1ce/0x250 kernel/task_work.c:239
exit_task_work include/linux/task_work.h:43 [inline]
do_exit+0x90b/0x23c0 kernel/exit.c:883
do_group_exit+0x21b/0x2d0 kernel/exit.c:1024
__do_sys_exit_group kernel/exit.c:1035 [inline]
__se_sys_exit_group kernel/exit.c:1033 [inline]
__x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1033
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

Memory state around the buggy address:
ffff88805b4a8100: fb fb fb fb fb fb fc fc fc fc fa fb fb fb fb fb
ffff88805b4a8180: fb fb fb fb fc fc fc fc fa fb fb fb fb fb fb fb
>ffff88805b4a8200: fb fb fc fc fc fc fa fb fb fb fb fb fb fb fb fb
^
ffff88805b4a8280: fc fc fc fc fa fb fb fb fb fb fb fb fb fb fc fc
ffff88805b4a8300: fc fc fa fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages