syzbot


KASAN: slab-out-of-bounds Read in f2fs_truncate_data_blocks_range

Status: moderation: reported on 2025/09/11 05:05
Subsystems: f2fs
[Documentation on labels]
Reported-by: syzbot+8935b5b30dadb820a6a7@syzkaller.appspotmail.com
First crash: 5d04h, last: 5d04h
Similar bugs (5)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: use-after-free Read in f2fs_truncate_data_blocks_range 19 C error error 4 31d 853d 0/2 upstream: reported C repro on 2023/05/12 18:24
android-54 KASAN: use-after-free Read in f2fs_truncate_data_blocks_range 19 C 3 139d 853d 0/2 upstream: reported C repro on 2023/05/12 11:37
upstream KASAN: slab-use-after-free Read in f2fs_truncate_data_blocks_range f2fs 19 C error 1 813d 809d 23/29 fixed on 2023/10/12 12:47
android-5-15 KASAN: use-after-free Read in f2fs_truncate_data_blocks_range origin:lts 19 C 3 14d 14d 0/2 upstream: reported C repro on 2025/08/28 23:47
android-6-1 KASAN: use-after-free Read in f2fs_truncate_data_blocks_range origin:upstream missing-backport 19 C error error 2 58d 853d 0/2 upstream: reported C repro on 2023/05/12 15:50

Sample crash report:
 </TASK>
F2FS-fs (loop0): access invalid blkaddr:6
CPU: 0 UID: 0 PID: 5358 Comm: syz.0.0 Not tainted syzkaller #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
 __f2fs_is_valid_blkaddr+0xe52/0x14f0 fs/f2fs/checkpoint.c:213
 f2fs_truncate_data_blocks_range+0x790/0x1390 fs/f2fs/file.c:674
 __clone_blkaddrs fs/f2fs/file.c:1432 [inline]
 __exchange_data_block+0x1b4d/0x31a0 fs/f2fs/file.c:1515
 f2fs_do_collapse fs/f2fs/file.c:1555 [inline]
 f2fs_collapse_range+0x296/0x3e0 fs/f2fs/file.c:1584
 f2fs_fallocate+0x55d/0x990 fs/f2fs/file.c:2020
 vfs_fallocate+0x669/0x7e0 fs/open.c:342
 ksys_fallocate fs/open.c:366 [inline]
 __do_sys_fallocate fs/open.c:371 [inline]
 __se_sys_fallocate fs/open.c:369 [inline]
 __x64_sys_fallocate+0xc0/0x110 fs/open.c:369
 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:0x7f1d6098ebe9
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:00007f1d6178a038 EFLAGS: 00000246 ORIG_RAX: 000000000000011d
RAX: ffffffffffffffda RBX: 00007f1d60bc5fa0 RCX: 00007f1d6098ebe9
RDX: 0000000000002000 RSI: 0000000000000008 RDI: 000000000000000a
RBP: 00007f1d60a11e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000007000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f1d60bc6038 R14: 00007f1d60bc5fa0 R15: 00007ffefaa2cbd8
 </TASK>
F2FS-fs (loop0): access invalid blkaddr:2359534912
CPU: 0 UID: 0 PID: 5358 Comm: syz.0.0 Not tainted syzkaller #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
 __f2fs_is_valid_blkaddr+0xe52/0x14f0 fs/f2fs/checkpoint.c:213
 f2fs_truncate_data_blocks_range+0x790/0x1390 fs/f2fs/file.c:674
 __clone_blkaddrs fs/f2fs/file.c:1432 [inline]
 __exchange_data_block+0x1b4d/0x31a0 fs/f2fs/file.c:1515
 f2fs_do_collapse fs/f2fs/file.c:1555 [inline]
 f2fs_collapse_range+0x296/0x3e0 fs/f2fs/file.c:1584
 f2fs_fallocate+0x55d/0x990 fs/f2fs/file.c:2020
 vfs_fallocate+0x669/0x7e0 fs/open.c:342
 ksys_fallocate fs/open.c:366 [inline]
 __do_sys_fallocate fs/open.c:371 [inline]
 __se_sys_fallocate fs/open.c:369 [inline]
 __x64_sys_fallocate+0xc0/0x110 fs/open.c:369
 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:0x7f1d6098ebe9
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:00007f1d6178a038 EFLAGS: 00000246 ORIG_RAX: 000000000000011d
RAX: ffffffffffffffda RBX: 00007f1d60bc5fa0 RCX: 00007f1d6098ebe9
RDX: 0000000000002000 RSI: 0000000000000008 RDI: 000000000000000a
RBP: 00007f1d60a11e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000007000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f1d60bc6038 R14: 00007f1d60bc5fa0 R15: 00007ffefaa2cbd8
 </TASK>
==================================================================
BUG: KASAN: slab-out-of-bounds in f2fs_truncate_data_blocks_range+0x956/0x1390 fs/f2fs/file.c:698
Read of size 4 at addr ffff8880520de1a0 by task syz.0.0/5358

CPU: 0 UID: 0 PID: 5358 Comm: syz.0.0 Not tainted syzkaller #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
 f2fs_truncate_data_blocks_range+0x956/0x1390 fs/f2fs/file.c:698
 __clone_blkaddrs fs/f2fs/file.c:1432 [inline]
 __exchange_data_block+0x1b4d/0x31a0 fs/f2fs/file.c:1515
 f2fs_do_collapse fs/f2fs/file.c:1555 [inline]
 f2fs_collapse_range+0x296/0x3e0 fs/f2fs/file.c:1584
 f2fs_fallocate+0x55d/0x990 fs/f2fs/file.c:2020
 vfs_fallocate+0x669/0x7e0 fs/open.c:342
 ksys_fallocate fs/open.c:366 [inline]
 __do_sys_fallocate fs/open.c:371 [inline]
 __se_sys_fallocate fs/open.c:369 [inline]
 __x64_sys_fallocate+0xc0/0x110 fs/open.c:369
 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:0x7f1d6098ebe9
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:00007f1d6178a038 EFLAGS: 00000246 ORIG_RAX: 000000000000011d
RAX: ffffffffffffffda RBX: 00007f1d60bc5fa0 RCX: 00007f1d6098ebe9
RDX: 0000000000002000 RSI: 0000000000000008 RDI: 000000000000000a
RBP: 00007f1d60a11e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000007000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f1d60bc6038 R14: 00007f1d60bc5fa0 R15: 00007ffefaa2cbd8
 </TASK>

Allocated by task 5336:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:68
 unpoison_slab_object mm/kasan/common.c:330 [inline]
 __kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:356
 kasan_slab_alloc include/linux/kasan.h:250 [inline]
 slab_post_alloc_hook mm/slub.c:4191 [inline]
 slab_alloc_node mm/slub.c:4240 [inline]
 kmem_cache_alloc_noprof+0x1c1/0x3c0 mm/slub.c:4247
 __kernfs_new_node+0xd7/0x7e0 fs/kernfs/dir.c:637
 kernfs_new_node+0x102/0x210 fs/kernfs/dir.c:713
 __kernfs_create_file+0x4b/0x2e0 fs/kernfs/file.c:1039
 sysfs_add_file_mode_ns+0x238/0x300 fs/sysfs/file.c:319
 sysfs_create_file_ns+0x128/0x1a0 fs/sysfs/file.c:386
 sysfs_create_file include/linux/sysfs.h:771 [inline]
 br_sysfs_addif+0xc8/0x240 net/bridge/br_sysfs_if.c:382
 br_add_if+0x3a6/0xec0 net/bridge/br_if.c:618
 do_set_master+0x533/0x6d0 net/core/rtnetlink.c:2948
 do_setlink+0xcf0/0x41c0 net/core/rtnetlink.c:3150
 rtnl_changelink net/core/rtnetlink.c:3761 [inline]
 __rtnl_newlink net/core/rtnetlink.c:3920 [inline]
 rtnl_newlink+0x160b/0x1c70 net/core/rtnetlink.c:4057
 rtnetlink_rcv_msg+0x7cf/0xb70 net/core/rtnetlink.c:6946
 netlink_rcv_skb+0x205/0x470 net/netlink/af_netlink.c:2552
 netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
 netlink_unicast+0x82f/0x9e0 net/netlink/af_netlink.c:1346
 netlink_sendmsg+0x805/0xb30 net/netlink/af_netlink.c:1896
 sock_sendmsg_nosec net/socket.c:714 [inline]
 __sock_sendmsg+0x21c/0x270 net/socket.c:729
 __sys_sendto+0x3bd/0x520 net/socket.c:2228
 __do_sys_sendto net/socket.c:2235 [inline]
 __se_sys_sendto net/socket.c:2231 [inline]
 __x64_sys_sendto+0xde/0x100 net/socket.c:2231
 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

The buggy address belongs to the object at ffff8880520de0f0
 which belongs to the cache kernfs_node_cache of size 176
The buggy address is located 0 bytes to the right of
 allocated 176-byte region [ffff8880520de0f0, ffff8880520de1a0)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x520de
flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 04fff00000000000 ffff88801b6ccdc0 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000110011 00000000f5000000 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 0x52cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 5336, tgid 5336 (syz-executor), ts 72037528364, free_ts 0
 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
 alloc_slab_page mm/slub.c:2492 [inline]
 allocate_slab+0x8a/0x370 mm/slub.c:2660
 new_slab mm/slub.c:2714 [inline]
 ___slab_alloc+0xbeb/0x1420 mm/slub.c:3901
 __slab_alloc mm/slub.c:3992 [inline]
 __slab_alloc_node mm/slub.c:4067 [inline]
 slab_alloc_node mm/slub.c:4228 [inline]
 kmem_cache_alloc_noprof+0x283/0x3c0 mm/slub.c:4247
 __kernfs_new_node+0xd7/0x7e0 fs/kernfs/dir.c:637
 kernfs_new_node+0x102/0x210 fs/kernfs/dir.c:713
 __kernfs_create_file+0x4b/0x2e0 fs/kernfs/file.c:1039
 sysfs_add_file_mode_ns+0x238/0x300 fs/sysfs/file.c:319
 sysfs_create_file_ns+0x128/0x1a0 fs/sysfs/file.c:386
 sysfs_create_file include/linux/sysfs.h:771 [inline]
 br_sysfs_addif+0xc8/0x240 net/bridge/br_sysfs_if.c:382
 br_add_if+0x3a6/0xec0 net/bridge/br_if.c:618
 do_set_master+0x533/0x6d0 net/core/rtnetlink.c:2948
 do_setlink+0xcf0/0x41c0 net/core/rtnetlink.c:3150
page_owner free stack trace missing

Memory state around the buggy address:
 ffff8880520de080: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc 00 00
 ffff8880520de100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880520de180: 00 00 00 00 fc fc fc fc fc fc fc fc 00 00 00 00
                               ^
 ffff8880520de200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880520de280: 00 00 fc fc fc fc fc fc fc fc 00 00 00 00 00 00
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/09/07 05:02 upstream b236920731dd d291dd2d .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-out-of-bounds Read in f2fs_truncate_data_blocks_range
* Struck through repros no longer work on HEAD.