[v6.1] KASAN: use-after-free Read in trace_event_raw_event_btrfs_delayed_tree_ref

0 views
Skip to first unread message

syzbot

unread,
Aug 10, 2026, 5:00:26 PM (6 days ago) Aug 10
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: e4f7d8be268e Linux 6.1.182
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1631f079580000
kernel config: https://syzkaller.appspot.com/x/.config?x=872c04466179833f
dashboard link: https://syzkaller.appspot.com/bug?extid=350163b09a8b92afc566
compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8
userspace arch: arm64

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/7cd9b1875376/disk-e4f7d8be.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/4b5d35d18c31/vmlinux-e4f7d8be.xz
kernel image: https://storage.googleapis.com/syzbot-assets/d5ee64c2af77/Image-e4f7d8be.gz.xz

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

BTRFS info (device loop2): clearing compat-ro feature flag for FREE_SPACE_TREE (0x1)
BTRFS info (device loop2): clearing compat-ro feature flag for FREE_SPACE_TREE_VALID (0x2)
==================================================================
BUG: KASAN: use-after-free in do_trace_event_raw_event_btrfs_delayed_tree_ref include/trace/events/btrfs.h:865 [inline]
BUG: KASAN: use-after-free in trace_event_raw_event_btrfs_delayed_tree_ref+0x168/0x3f4 include/trace/events/btrfs.h:844
Read of size 8 at addr ffff0000ccaf78b0 by task syz.2.2132/9328

CPU: 1 PID: 9328 Comm: syz.2.2132 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/02/2026
Call trace:
dump_backtrace+0x1c4/0x1f0 arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack+0x30/0x40 lib/dump_stack.c:88
dump_stack_lvl+0xf4/0x15c lib/dump_stack.c:106
print_address_description+0x88/0x218 mm/kasan/report.c:316
print_report+0x50/0x68 mm/kasan/report.c:420
kasan_report+0xa8/0xfc mm/kasan/report.c:524
__asan_report_load8_noabort+0x2c/0x38 mm/kasan/report_generic.c:351
do_trace_event_raw_event_btrfs_delayed_tree_ref include/trace/events/btrfs.h:865 [inline]
trace_event_raw_event_btrfs_delayed_tree_ref+0x168/0x3f4 include/trace/events/btrfs.h:844
__traceiter_add_delayed_tree_ref+0x90/0xe8 include/trace/events/btrfs.h:887
trace_add_delayed_tree_ref include/trace/events/btrfs.h:887 [inline]
btrfs_add_delayed_tree_ref+0xc38/0xd28 fs/btrfs/delayed-ref.c:982
btrfs_free_tree_block+0x268/0xa38 fs/btrfs/extent-tree.c:3299
btrfs_force_cow_block+0xac0/0x18c0 fs/btrfs/ctree.c:527
btrfs_cow_block+0x2e0/0x71c fs/btrfs/ctree.c:623
btrfs_search_slot+0xa48/0x2380 fs/btrfs/ctree.c:-1
btrfs_insert_empty_items+0xa4/0x180 fs/btrfs/ctree.c:4185
btrfs_insert_empty_item fs/btrfs/ctree.h:3073 [inline]
btrfs_insert_orphan_item+0x13c/0x1cc fs/btrfs/orphan.c:24
btrfs_orphan_add+0x70/0x1bc fs/btrfs/inode.c:3738
btrfs_unlink+0x230/0x300 fs/btrfs/inode.c:4520
vfs_unlink+0x2e0/0x4f4 fs/namei.c:4330
do_unlinkat+0x318/0x504 fs/namei.c:4398
__do_sys_unlinkat fs/namei.c:4441 [inline]
__se_sys_unlinkat fs/namei.c:4434 [inline]
__arm64_sys_unlinkat+0xe0/0xfc fs/namei.c:4434
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x290 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x200/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x5c/0x134 arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x128 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:585

Allocated by task 9328:
kasan_save_stack mm/kasan/common.c:46 [inline]
kasan_set_track+0x4c/0x80 mm/kasan/common.c:53
kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505
__kasan_slab_alloc+0x70/0x88 mm/kasan/common.c:329
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook+0x74/0x430 mm/slab.h:737
slab_alloc_node mm/slub.c:3359 [inline]
slab_alloc mm/slub.c:3367 [inline]
__kmem_cache_alloc_lru mm/slub.c:3374 [inline]
kmem_cache_alloc+0x234/0x310 mm/slub.c:3383
btrfs_add_delayed_tree_ref+0x160/0xd28 fs/btrfs/delayed-ref.c:926
btrfs_free_tree_block+0x268/0xa38 fs/btrfs/extent-tree.c:3299
btrfs_force_cow_block+0xac0/0x18c0 fs/btrfs/ctree.c:527
btrfs_cow_block+0x2e0/0x71c fs/btrfs/ctree.c:623
btrfs_search_slot+0xa48/0x2380 fs/btrfs/ctree.c:-1
btrfs_insert_empty_items+0xa4/0x180 fs/btrfs/ctree.c:4185
btrfs_insert_empty_item fs/btrfs/ctree.h:3073 [inline]
btrfs_insert_orphan_item+0x13c/0x1cc fs/btrfs/orphan.c:24
btrfs_orphan_add+0x70/0x1bc fs/btrfs/inode.c:3738
btrfs_unlink+0x230/0x300 fs/btrfs/inode.c:4520
vfs_unlink+0x2e0/0x4f4 fs/namei.c:4330
do_unlinkat+0x318/0x504 fs/namei.c:4398
__do_sys_unlinkat fs/namei.c:4441 [inline]
__se_sys_unlinkat fs/namei.c:4434 [inline]
__arm64_sys_unlinkat+0xe0/0xfc fs/namei.c:4434
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x290 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x200/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x5c/0x134 arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x128 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:585

Freed by task 9:
kasan_save_stack mm/kasan/common.c:46 [inline]
kasan_set_track+0x4c/0x80 mm/kasan/common.c:53
kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:516
____kasan_slab_free+0x148/0x1b0 mm/kasan/common.c:237
__kasan_slab_free+0x18/0x28 mm/kasan/common.c:245
kasan_slab_free include/linux/kasan.h:177 [inline]
slab_free_hook mm/slub.c:1729 [inline]
slab_free_freelist_hook+0x16c/0x1e8 mm/slub.c:1755
slab_free mm/slub.c:3687 [inline]
kmem_cache_free+0x118/0x318 mm/slub.c:3709
btrfs_put_delayed_ref+0x18c/0x250 fs/btrfs/delayed-ref.h:-1
btrfs_run_delayed_refs_for_head fs/btrfs/extent-tree.c:1979 [inline]
__btrfs_run_delayed_refs+0x1400/0x3374 fs/btrfs/extent-tree.c:2033
btrfs_run_delayed_refs+0x11c/0x474 fs/btrfs/extent-tree.c:2164
btrfs_commit_transaction+0x1e4/0x28e4 fs/btrfs/transaction.c:2191
btrfs_qgroup_rescan_worker+0x14cc/0x156c fs/btrfs/qgroup.c:3423
btrfs_work_helper+0x328/0xcbc fs/btrfs/async-thread.c:280
process_one_work+0x7e4/0x13bc kernel/workqueue.c:2292
worker_thread+0x8cc/0xfe8 kernel/workqueue.c:2439
kthread+0x254/0x2e0 kernel/kthread.c:376
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:850

The buggy address belongs to the object at ffff0000ccaf7888
which belongs to the cache btrfs_delayed_tree_ref of size 104
The buggy address is located 40 bytes inside of
104-byte region [ffff0000ccaf7888, ffff0000ccaf78f0)

The buggy address belongs to the physical page:
page:000000003bc07a17 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff0000ccaf7348 pfn:0x10caf7
flags: 0x5ffc00000000200(slab|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000000200 0000000000000000 dead000000000122 ffff0000ca57f980
raw: ffff0000ccaf7348 0000000080180010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff0000ccaf7780: fb fb fb fb fc fc fc fc fc fc fc fc fa fb fb fb
ffff0000ccaf7800: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
>ffff0000ccaf7880: fc fa fb fb fb fb fb fb fb fb fb fb fb fb fc fc
^
ffff0000ccaf7900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff0000ccaf7980: fc fc fc fc fc fc fc fc fc fc fc fc 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