syzbot


KASAN: slab-use-after-free Write in btrfs_put_root

Status: upstream: reported on 2026/06/02 11:26
Subsystems: btrfs
Labels: prio:high actionable
[Documentation on labels]
Reported-by: syzbot+b3d472d13f9d7bf20669@syzkaller.appspotmail.com
First crash: 20d, last: 2h51m
✨ AI Jobs (2)
ID Workflow Result Correct Bug Created Started Finished Revision Error
b0c8c364-3574-4284-9cfe-5a9d65f07ed7 moderation Actionable: ✅ KASAN: slab-use-after-free Write in btrfs_put_root 2026/06/02 10:23 2026/06/02 10:23 2026/06/02 11:25 1095583bae1d2729a3b4be301cb6ddc85ced9e38
ef4c4a12-097a-4049-9fa8-e1ef776e8856 assessment-security DenialOfService: ✅ Exploitable: ✅ FilesystemTrigger: ✅ NetworkTrigger: ❌ PeripheralTrigger: ✅ RemoteTrigger: ❌ Unprivileged: ❌ UserNamespace: ❌ VMGuestTrigger: ❌ VMHostTrigger: ❌ KASAN: slab-use-after-free Write in btrfs_put_root 2026/06/02 10:05 2026/06/02 10:05 2026/06/02 11:03 1095583bae1d2729a3b4be301cb6ddc85ced9e38
Discussions (2)
Title Replies (including bot) Last reply
[syzbot] Monthly btrfs report (Jun 2026) 0 (1) 2026/06/03 04:32
[syzbot] [btrfs?] KASAN: slab-use-after-free Write in btrfs_put_root 0 (1) 2026/06/02 11:26

Sample crash report:
BTRFS info (device loop0 state EA): last unmount of filesystem c9fe44da-de57-406a-8241-57ec7d4412cf
==================================================================
BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
BUG: KASAN: slab-use-after-free in atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline]
BUG: KASAN: slab-use-after-free in __refcount_sub_and_test include/linux/refcount.h:389 [inline]
BUG: KASAN: slab-use-after-free in __refcount_dec_and_test include/linux/refcount.h:432 [inline]
BUG: KASAN: slab-use-after-free in refcount_dec_and_test include/linux/refcount.h:450 [inline]
BUG: KASAN: slab-use-after-free in btrfs_put_root+0x2f/0x250 fs/btrfs/disk-io.c:1806
Write of size 4 at addr ffff88801f92a630 by task syz.0.0/5337

CPU: 0 UID: 0 PID: 5337 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 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 print_address_description+0x55/0x1e0 mm/kasan/report.c:378
 print_report+0x58/0x70 mm/kasan/report.c:482
 kasan_report+0x117/0x150 mm/kasan/report.c:595
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x264/0x2c0 mm/kasan/generic.c:200
 instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
 atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline]
 __refcount_sub_and_test include/linux/refcount.h:389 [inline]
 __refcount_dec_and_test include/linux/refcount.h:432 [inline]
 refcount_dec_and_test include/linux/refcount.h:450 [inline]
 btrfs_put_root+0x2f/0x250 fs/btrfs/disk-io.c:1806
 btrfs_drop_and_free_fs_root+0x160/0x210 fs/btrfs/disk-io.c:4154
 btrfs_free_fs_roots+0x2f9/0x3c0 fs/btrfs/disk-io.c:1847
 close_ctree+0x798/0x12d0 fs/btrfs/disk-io.c:4442
 generic_shutdown_super+0x13d/0x2d0 fs/super.c:646
 kill_anon_super+0x3b/0x70 fs/super.c:1292
 btrfs_kill_super+0x41/0x50 fs/btrfs/super.c:2127
 deactivate_locked_super+0xbc/0x130 fs/super.c:476
 cleanup_mnt+0x437/0x4d0 fs/namespace.c:1312
 task_work_run+0x1d9/0x270 kernel/task_work.c:233
 exit_task_work include/linux/task_work.h:40 [inline]
 do_exit+0x70f/0x22c0 kernel/exit.c:976
 do_group_exit+0x21b/0x2d0 kernel/exit.c:1119
 __do_sys_exit_group kernel/exit.c:1130 [inline]
 __se_sys_exit_group kernel/exit.c:1128 [inline]
 __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1128
 x64_sys_call+0x221a/0x2240 arch/x86/include/generated/asm/syscalls_64.h:232
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f1f1d19ce59
Code: Unable to access opcode bytes at 0x7f1f1d19ce2f.
RSP: 002b:00007ffd7ed8aed8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f1f1d19ce59
RDX: 00007f1f1a5f8000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000003 R08: 0000000000000000 R09: 00007f1f1d3e73e0
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f1f1d3e73e0 R14: 0000000000000003 R15: 00007ffd7ed8af90
 </TASK>

Allocated by task 1071:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 poison_kmalloc_redzone mm/kasan/common.c:398 [inline]
 __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:415
 kasan_kmalloc include/linux/kasan.h:263 [inline]
 __kmalloc_cache_noprof+0x31c/0x660 mm/slub.c:5420
 kmalloc_noprof include/linux/slab.h:950 [inline]
 kzalloc_noprof include/linux/slab.h:1188 [inline]
 btrfs_alloc_root+0x75/0x930 fs/btrfs/disk-io.c:611
 read_tree_root_path+0x127/0xb00 fs/btrfs/disk-io.c:976
 btrfs_read_tree_root+0x34/0x60 fs/btrfs/disk-io.c:1040
 create_reloc_root+0x6b3/0xcb0 fs/btrfs/relocation.c:677
 btrfs_init_reloc_root+0x2ec/0x4b0 fs/btrfs/relocation.c:744
 record_root_in_trans+0x2ab/0x350 fs/btrfs/transaction.c:461
 btrfs_record_root_in_trans+0x15c/0x180 fs/btrfs/transaction.c:507
 start_transaction+0x39c/0x1820 fs/btrfs/transaction.c:793
 btrfs_finish_one_ordered+0x88e/0x2680 fs/btrfs/inode.c:3254
 btrfs_work_helper+0x37b/0xc20 fs/btrfs/async-thread.c:312
 process_one_work kernel/workqueue.c:3314 [inline]
 process_scheduled_works+0xb5d/0x1860 kernel/workqueue.c:3397
 worker_thread+0xa53/0xfc0 kernel/workqueue.c:3478
 kthread+0x389/0x470 kernel/kthread.c:436
 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

Freed by task 5339:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:584
 poison_slab_object mm/kasan/common.c:253 [inline]
 __kasan_slab_free+0x5c/0x80 mm/kasan/common.c:285
 kasan_slab_free include/linux/kasan.h:235 [inline]
 slab_free_hook mm/slub.c:2689 [inline]
 slab_free mm/slub.c:6251 [inline]
 kfree+0x1c5/0x640 mm/slub.c:6566
 __del_reloc_root+0x341/0x3b0 fs/btrfs/relocation.c:547
 free_reloc_roots+0x5f/0x90 fs/btrfs/relocation.c:1803
 merge_reloc_roots+0x73f/0x8a0 fs/btrfs/relocation.c:1888
 relocate_block_group+0xbcc/0xe70 fs/btrfs/relocation.c:3638
 do_nonremap_reloc+0xa8/0x5b0 fs/btrfs/relocation.c:5268
 btrfs_relocate_block_group+0x7e6/0xc40 fs/btrfs/relocation.c:5434
 btrfs_relocate_chunk+0x115/0x820 fs/btrfs/volumes.c:3598
 __btrfs_balance+0x1db0/0x2ae0 fs/btrfs/volumes.c:4509
 btrfs_balance+0xaf3/0x11b0 fs/btrfs/volumes.c:4896
 btrfs_ioctl_balance+0x3d3/0x610 fs/btrfs/ioctl.c:3453
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:597 [inline]
 __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff88801f92a000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 1584 bytes inside of
 freed 4096-byte region [ffff88801f92a000, ffff88801f92b000)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1f928
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff88801ac42140 dead000000000100 dead000000000122
raw: 0000000000000000 0000000800040004 00000000f5000000 0000000000000000
head: 00fff00000000040 ffff88801ac42140 dead000000000100 dead000000000122
head: 0000000000000000 0000000800040004 00000000f5000000 0000000000000000
head: 00fff00000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, tgid 1 (swapper/0), ts 4196752257, free_ts 0
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x22d/0x280 mm/page_alloc.c:1853
 prep_new_page mm/page_alloc.c:1861 [inline]
 get_page_from_freelist+0x2593/0x2610 mm/page_alloc.c:3941
 __alloc_frozen_pages_noprof+0x18d/0x380 mm/page_alloc.c:5221
 alloc_slab_page mm/slub.c:3278 [inline]
 allocate_slab+0x77/0x660 mm/slub.c:3467
 new_slab mm/slub.c:3525 [inline]
 refill_objects+0x339/0x3d0 mm/slub.c:7272
 refill_sheaf mm/slub.c:2816 [inline]
 __pcs_replace_empty_main+0x321/0x720 mm/slub.c:4652
 alloc_from_pcs mm/slub.c:4750 [inline]
 slab_alloc_node mm/slub.c:4884 [inline]
 __kmalloc_cache_noprof+0x392/0x660 mm/slub.c:5415
 kmalloc_noprof include/linux/slab.h:950 [inline]
 kzalloc_noprof include/linux/slab.h:1188 [inline]
 kobject_uevent_env+0x28c/0x9e0 lib/kobject_uevent.c:543
 device_add+0x557/0xbb0 drivers/base/core.c:3672
 pci_device_add+0x126e/0x1900 drivers/pci/probe.c:2772
 pci_scan_single_device+0x3d6/0x450 drivers/pci/probe.c:2797
 pci_scan_slot+0x1c5/0x5c0 drivers/pci/probe.c:2880
 pci_scan_child_bus_extend+0x68/0x7d0 drivers/pci/probe.c:3099
 acpi_pci_root_create+0xa75/0xca0 drivers/acpi/pci_root.c:1044
 pci_acpi_scan_root+0x3a3/0x580 arch/x86/pci/acpi.c:574
 acpi_pci_root_add+0x1d8d/0x2f20 drivers/acpi/pci_root.c:723
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88801f92a500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88801f92a580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88801f92a600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                     ^
 ffff88801f92a680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88801f92a700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/06/13 04:54 upstream 1dadb7e7eb5a 4f06757f .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-use-after-free Write in btrfs_put_root
2026/06/04 17:41 upstream ba3e43a9e601 197909be .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-use-after-free Write in btrfs_put_root
2026/05/30 20:14 upstream f5e5d3509bff 6b4a8443 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-use-after-free Write in btrfs_put_root
2026/05/24 05:27 upstream 4cbfe4502e3d c69befb3 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-use-after-free Write in btrfs_put_root
* Struck through repros no longer work on HEAD.