Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [syzbot] [btrfs?] KASAN: slab-use-after-free Read in igrab
@ 2026-12-04 22:09 syzbot
  0 siblings, 0 replies; only message in thread
From: syzbot @ 2026-12-04 22:09 UTC (permalink / raw)
  To: dsterba, linux-btrfs, linux-kernel, mason, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    d06ce6f1eb5e Merge tag 'for_linus' of git://git.kernel.org..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17ea82ff980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=fc1834b4a2e3ba54
dashboard link: https://syzkaller.appspot.com/bug?extid=9b287ab048073bea5a2c
compiler:       Debian clang version 22.1.8 (1~deb13u5), Debian LLD 22.1.8

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/44765da165e5/disk-d06ce6f1.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/7ded4515dc51/vmlinux-d06ce6f1.xz
kernel image: https://storage.googleapis.com/syzbot-assets/ad67e398df74/bzImage-d06ce6f1.xz

AI-generated root cause summary:
In btrfs_destroy_delalloc_inodes() (fs/btrfs/disk-io.c),
btrfs_del_delalloc_inode(btrfs_inode) removes the inode from the delalloc list
and spin_unlock(&root->delalloc_lock) is called before
igrab(&btrfs_inode->vfs_inode). Dropping root->delalloc_lock without holding an
inode reference or RCU protection allows a concurrent inode eviction (such as
evict_inodes() during unmount via generic_shutdown_super() before close_ctree()
stops transaction_kthread) to clear delalloc state in btrfs_evict_inode(), call
destroy_inode(), and free the btrfs_inode via call_rcu(). When btrfs-transacti
then executes or resumes inside igrab(&btrfs_inode->vfs_inode), it accesses the
freed btrfs_inode (specifically acquiring inode->i_lock), resulting in a
slab-use-after-free.

full analysis:  https://syzkaller.appspot.com/x/ai_root_cause?x=9b287ab048073bea5a2c

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

==================================================================
BUG: KASAN: slab-use-after-free in __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:155 [inline]
BUG: KASAN: slab-use-after-free in _raw_spin_lock_irqsave+0x40/0x60 kernel/locking/spinlock.c:181
Read of size 1 at addr ffff8880635b99d8 by task btrfs-transacti/20950

CPU: 0 UID: 0 PID: 20950 Comm: btrfs-transacti Not tainted syzkaller #0 PREEMPT_{RT,(full)} 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
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
 __kasan_check_byte+0x2a/0x40 mm/kasan/common.c:588
 kasan_check_byte include/linux/kasan.h:406 [inline]
 lock_acquire+0x7d/0x350 kernel/locking/lockdep.c:5916
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:155 [inline]
 _raw_spin_lock_irqsave+0x40/0x60 kernel/locking/spinlock.c:181
 rtlock_slowlock kernel/locking/rtmutex.c:1921 [inline]
 rtlock_lock kernel/locking/spinlock_rt.c:43 [inline]
 __rt_spin_lock kernel/locking/spinlock_rt.c:49 [inline]
 rt_spin_lock+0x157/0x400 kernel/locking/spinlock_rt.c:57
 spin_lock include/linux/spinlock_rt.h:45 [inline]
 igrab+0xfb/0x2f0 fs/inode.c:1616
 btrfs_destroy_delalloc_inodes fs/btrfs/disk-io.c:4809 [inline]
 btrfs_destroy_all_delalloc_inodes fs/btrfs/disk-io.c:4837 [inline]
 btrfs_cleanup_transaction+0xda3/0x17e0 fs/btrfs/disk-io.c:5033
 transaction_kthread+0x398/0x460 fs/btrfs/disk-io.c:1650
 kthread+0x38b/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
 </TASK>

Allocated by task 20956:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3f/0x90 mm/kasan/common.c:79
 unpoison_slab_object mm/kasan/common.c:354 [inline]
 __kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:380
 kasan_slab_alloc include/linux/kasan.h:257 [inline]
 slab_post_alloc_hook mm/slub.c:4720 [inline]
 slab_alloc_node mm/slub.c:5033 [inline]
 kmem_cache_alloc_lru_noprof+0x358/0x680 mm/slub.c:5066
 btrfs_alloc_inode+0x58/0x380 fs/btrfs/inode.c:8012
 alloc_inode+0x6a/0x1b0 fs/inode.c:338
 iget5_locked_rcu+0x17f/0x220 fs/inode.c:1449
 btrfs_iget_locked fs/btrfs/inode.c:5885 [inline]
 btrfs_iget+0x12e/0x340 fs/btrfs/inode.c:5927
 btrfs_lookup_dentry+0x487/0x1390 fs/btrfs/inode.c:6023
 btrfs_lookup+0x1d/0x40 fs/btrfs/inode.c:6091
 __lookup_slow+0x1fb/0x2f0 fs/namei.c:1925
 lookup_slow+0x59/0x80 fs/namei.c:1942
 walk_component fs/namei.c:2288 [inline]
 lookup_last fs/namei.c:2795 [inline]
 path_lookupat+0x3f5/0x8c0 fs/namei.c:2819
 filename_lookup+0x265/0x5d0 fs/namei.c:2848
 ksys_truncate+0xbb/0x1c0 fs/open.c:140
 __do_sys_truncate fs/open.c:154 [inline]
 __se_sys_truncate fs/open.c:152 [inline]
 __x64_sys_truncate+0x5b/0x70 fs/open.c:152
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 20:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3f/0x90 mm/kasan/common.c:79
 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:599
 poison_slab_object mm/kasan/common.c:267 [inline]
 __kasan_slab_free+0x70/0x90 mm/kasan/common.c:299
 kasan_slab_free include/linux/kasan.h:239 [inline]
 slab_free_hook mm/slub.c:2780 [inline]
 slab_free mm/slub.c:6637 [inline]
 kmem_cache_free+0x189/0x6d0 mm/slub.c:6764
 rcu_do_batch kernel/rcu/tree.c:2650 [inline]
 rcu_core kernel/rcu/tree.c:2919 [inline]
 rcu_cpu_kthread+0xb2f/0x1700 kernel/rcu/tree.c:3007
 smpboot_thread_fn+0x5f8/0xb30 kernel/smpboot.c:162
 kthread+0x38b/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

Last potentially related work creation:
 kasan_save_stack+0x3e/0x60 mm/kasan/common.c:57
 __kasan_record_aux_stack+0xc5/0xe0 mm/kasan/generic.c:561
 __call_rcu_common kernel/rcu/tree.c:3287 [inline]
 call_rcu+0x86/0x300 kernel/rcu/tree.c:3395
 destroy_inode fs/inode.c:392 [inline]
 evict+0xa27/0xc20 fs/inode.c:853
 dispose_list fs/inode.c:871 [inline]
 evict_inodes+0x844/0x8c0 fs/inode.c:924
 generic_shutdown_super+0xad/0x2d0 fs/super.c:709
 kill_anon_super+0x3b/0x70 fs/super.c:1315
 btrfs_kill_super+0x41/0x50 fs/btrfs/super.c:2139
 deactivate_locked_super+0xbe/0x110 fs/super.c:558
 cleanup_mnt+0x204/0x2a0 fs/namespace.c:1396
 task_work_run+0x1d9/0x260 kernel/task_work.c:233
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 __exit_to_user_mode_loop kernel/entry/common.c:70 [inline]
 exit_to_user_mode_loop+0x204/0x770 kernel/entry/common.c:101
 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
 syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:343 [inline]
 do_syscall_64+0x336/0x540 arch/x86/entry/syscall_64.c:107
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff8880635b9470
 which belongs to the cache btrfs_inode of size 2488
The buggy address is located 1384 bytes inside of
 freed 2488-byte region [ffff8880635b9470, ffff8880635b9e28)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x635b8
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff8880635bfaa1
flags: 0x80000000000040(head|node=0|zone=1)
page_type: f5(slab)
raw: 0080000000000040 ffff88814b6d8a00 dead000000000100 dead000000000122
raw: 0000000000000000 00000002000c000c 00000000f5000000 ffff8880635bfaa1
head: 0080000000000040 ffff88814b6d8a00 dead000000000100 dead000000000122
head: 0000000000000000 00000002000c000c 00000000f5000000 ffff8880635bfaa1
head: 0080000000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff
head: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Reclaimable, gfp_mask 0xd20d0(__GFP_RECLAIMABLE|__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5834, tgid 5824 (syz.1.2), ts 93409249582
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1f9/0x250 mm/page_alloc.c:1873
 prep_new_page+0x22/0xb0 mm/page_alloc.c:1881
 get_page_from_freelist+0x280d/0x2850 mm/page_alloc.c:3963
 __alloc_frozen_pages_noprof+0x230/0x470 mm/page_alloc.c:5505
 alloc_slab_page mm/slub.c:3384 [inline]
 allocate_slab+0x7d/0x5e0 mm/slub.c:3499
 new_slab mm/slub.c:3550 [inline]
 refill_objects+0x2d8/0x350 mm/slub.c:7554
 refill_sheaf mm/slub.c:2917 [inline]
 __pcs_replace_empty_main+0x339/0x690 mm/slub.c:4811
 alloc_from_pcs mm/slub.c:4887 [inline]
 slab_alloc_node mm/slub.c:5021 [inline]
 kmem_cache_alloc_lru_noprof+0x450/0x680 mm/slub.c:5066
 btrfs_alloc_inode+0x58/0x380 fs/btrfs/inode.c:8012
 alloc_inode+0x6a/0x1b0 fs/inode.c:338
 new_inode+0x1f/0x170 fs/inode.c:1192
 btrfs_init_btree_inode fs/btrfs/disk-io.c:1990 [inline]
 open_ctree+0x5e3/0x4140 fs/btrfs/disk-io.c:3449
 btrfs_fill_super fs/btrfs/super.c:971 [inline]
 btrfs_get_tree_super fs/btrfs/super.c:1956 [inline]
 btrfs_get_tree_subvol fs/btrfs/super.c:2099 [inline]
 btrfs_get_tree+0x10cf/0x1a00 fs/btrfs/super.c:2133
 vfs_get_tree+0x92/0x2a0 fs/super.c:1881
 fc_mount fs/namespace.c:1282 [inline]
 do_new_mount_fc fs/namespace.c:3910 [inline]
 do_new_mount+0x325/0xb00 fs/namespace.c:3986
 do_mount fs/namespace.c:4350 [inline]
 __do_sys_mount fs/namespace.c:4563 [inline]
 __se_sys_mount+0x31d/0x420 fs/namespace.c:4540
page_owner free stack trace missing

Memory state around the buggy address:
 ffff8880635b9880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880635b9900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880635b9980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                    ^
 ffff8880635b9a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880635b9a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-04 22:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 22:09 [syzbot] [btrfs?] KASAN: slab-use-after-free Read in igrab syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox