[moderation] [block?] KASAN: slab-use-after-free Read in sync_blockdev_nowait

0 views
Skip to first unread message

syzbot

unread,
Oct 1, 2025, 11:23:36 AM (2 days ago) Oct 1
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 2213e57a69f0 Merge branch 'for-next/core' into for-kernelci
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=14e6bd34580000
kernel config: https://syzkaller.appspot.com/x/.config?x=714d45b6135c308e
dashboard link: https://syzkaller.appspot.com/bug?extid=14a00f46e5c41f3e3f6a
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
userspace arch: arm64
CC: [ax...@kernel.dk linux...@vger.kernel.org linux-...@vger.kernel.org]

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/bf4625d47a8f/disk-2213e57a.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/270abffcbf3c/vmlinux-2213e57a.xz
kernel image: https://storage.googleapis.com/syzbot-assets/1f0f6eb3e385/Image-2213e57a.gz.xz

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

==================================================================
BUG: KASAN: slab-use-after-free in sync_blockdev_nowait+0x40/0x64 block/bdev.c:248
Read of size 8 at addr ffff0000c1494538 by task syz-executor/6529

CPU: 1 UID: 0 PID: 6529 Comm: syz-executor Not tainted syzkaller #0 PREEMPT
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/30/2025
Call trace:
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:499 (C)
__dump_stack+0x30/0x40 lib/dump_stack.c:94
dump_stack_lvl+0xd8/0x12c lib/dump_stack.c:120
print_address_description+0xa8/0x238 mm/kasan/report.c:378
print_report+0x68/0x84 mm/kasan/report.c:482
kasan_report+0xb0/0x110 mm/kasan/report.c:595
__asan_report_load8_noabort+0x20/0x2c mm/kasan/report_generic.c:381
sync_blockdev_nowait+0x40/0x64 block/bdev.c:248
sync_filesystem+0x13c/0x218 fs/sync.c:60
generic_shutdown_super+0x70/0x2b8 fs/super.c:622
bch2_kill_sb+0x40/0x58 fs/bcachefs/fs.c:2618
deactivate_locked_super+0xc4/0x12c fs/super.c:474
deactivate_super+0xe0/0x100 fs/super.c:507
cleanup_mnt+0x31c/0x3ac fs/namespace.c:1375
__cleanup_mnt+0x20/0x30 fs/namespace.c:1382
task_work_run+0x1dc/0x260 kernel/task_work.c:227
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
exit_to_user_mode_loop+0xfc/0x168 kernel/entry/common.c:43
exit_to_user_mode_prepare include/linux/irq-entry-common.h:225 [inline]
arm64_exit_to_user_mode arch/arm64/kernel/entry-common.c:103 [inline]
el0_svc+0x170/0x254 arch/arm64/kernel/entry-common.c:745
el0t_64_sync_handler+0x84/0x12c arch/arm64/kernel/entry-common.c:763
el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:596

Allocated by task 1:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x40/0x78 mm/kasan/common.c:68
kasan_save_alloc_info+0x44/0x54 mm/kasan/generic.c:562
unpoison_slab_object mm/kasan/common.c:330 [inline]
__kasan_slab_alloc+0x70/0x88 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_lru_noprof+0x23c/0x3ec mm/slub.c:4259
bdev_alloc_inode+0x30/0xa0 block/bdev.c:364
alloc_inode+0x68/0x19c fs/inode.c:346
new_inode+0x2c/0x130 fs/inode.c:1145
bdev_alloc+0x34/0x338 block/bdev.c:461
__alloc_disk_node+0x100/0x43c block/genhd.c:1465
__blk_mq_alloc_disk+0x1bc/0x304 block/blk-mq.c:4451
loop_add+0x324/0x880 drivers/block/loop.c:2043
loop_init+0xe8/0x10c drivers/block/loop.c:2278
do_one_initcall+0x250/0x990 init/main.c:1269
do_initcall_level+0x128/0x1c4 init/main.c:1331
do_initcalls+0x70/0xd0 init/main.c:1347
do_basic_setup+0x78/0x8c init/main.c:1366
kernel_init_freeable+0x268/0x39c init/main.c:1579
kernel_init+0x24/0x1dc init/main.c:1469
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:844

Freed by task 3:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x40/0x78 mm/kasan/common.c:68
kasan_save_free_info+0x58/0x70 mm/kasan/generic.c:576
poison_slab_object mm/kasan/common.c:243 [inline]
__kasan_slab_free+0x74/0x98 mm/kasan/common.c:275
kasan_slab_free include/linux/kasan.h:233 [inline]
slab_free_hook mm/slub.c:2422 [inline]
slab_free mm/slub.c:4695 [inline]
kmem_cache_free+0x184/0x550 mm/slub.c:4797
bdev_free_inode+0x178/0x1d8 block/bdev.c:394
i_callback+0x50/0x78 fs/inode.c:325
rcu_do_batch kernel/rcu/tree.c:2605 [inline]
rcu_core+0x840/0x17d0 kernel/rcu/tree.c:2861
rcu_core_si+0x10/0x1c kernel/rcu/tree.c:2878
handle_softirqs+0x328/0xc88 kernel/softirq.c:579
__do_softirq+0x14/0x20 kernel/softirq.c:613

Last potentially related work creation:
kasan_save_stack+0x40/0x6c mm/kasan/common.c:47
kasan_record_aux_stack+0xb0/0xc8 mm/kasan/generic.c:548
__call_rcu_common kernel/rcu/tree.c:3123 [inline]
call_rcu+0x100/0x978 kernel/rcu/tree.c:3243
destroy_inode fs/inode.c:401 [inline]
evict+0x754/0x928 fs/inode.c:834
iput_final fs/inode.c:1897 [inline]
iput+0x6e4/0x83c fs/inode.c:1923
bdev_drop+0x20/0x30 block/bdev.c:513
disk_release+0x240/0x268 block/genhd.c:1313
device_release+0x8c/0x1ac drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x2b0/0x438 lib/kobject.c:737
put_device+0x28/0x40 drivers/base/core.c:3797
put_disk+0x4c/0x64 block/genhd.c:1545
loop_remove+0x9c/0xcc drivers/block/loop.c:2121
loop_control_remove drivers/block/loop.c:2173 [inline]
loop_control_ioctl+0x44c/0x514 drivers/block/loop.c:2211
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:598 [inline]
__se_sys_ioctl fs/ioctl.c:584 [inline]
__arm64_sys_ioctl+0x14c/0x1c4 fs/ioctl.c:584
__invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
invoke_syscall+0x98/0x254 arch/arm64/kernel/syscall.c:49
el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132
do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151
el0_svc+0x5c/0x254 arch/arm64/kernel/entry-common.c:744
el0t_64_sync_handler+0x84/0x12c arch/arm64/kernel/entry-common.c:763
el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:596

The buggy address belongs to the object at ffff0000c1494500
which belongs to the cache bdev_cache of size 2808
The buggy address is located 56 bytes inside of
freed 2808-byte region [ffff0000c1494500, ffff0000c1494ff8)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101490
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x5ffc00000000040(head|node=0|zone=2|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 05ffc00000000040 ffff0000c18bd3c0 dead000000000122 0000000000000000
raw: 0000000000000000 00000000000b000b 00000000f5000000 0000000000000000
head: 05ffc00000000040 ffff0000c18bd3c0 dead000000000122 0000000000000000
head: 0000000000000000 00000000000b000b 00000000f5000000 0000000000000000
head: 05ffc00000000003 fffffdffc3052401 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff0000c1494400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
ffff0000c1494480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000c1494500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff0000c1494580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000c1494600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
bcachefs (loop0): shutting down
bcachefs (loop0): going read-only
bcachefs (loop0): finished waiting for writes to stop
bcachefs (loop0): flushing journal and stopping allocators, journal seq 18
bcachefs (loop0): flushing journal and stopping allocators complete, journal seq 18
bcachefs (loop0): insufficient writeable journal devices available: have 0, need 1
rw journal devs:
bcachefs (loop0): clean shutdown complete, journal seq 19
bcachefs (loop0): bch2_write_super(): fatal error : Unable to write superblock to sufficient devices (from bch2_fs_read_only)
bcachefs (loop0): done going read-only, filesystem not clean
bcachefs (loop0): shutdown complete


---
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