kernel BUG in set_state_bits (2)

Status: upstream: reported on 2026/08/06 00:13
Subsystems: btrfs
Labels: prio:high
[Documentation on labels]
Reported-by: syzbot+64579ad11e26758151bc@syzkaller.appspotmail.com
First crash: 63d, last: 3d03h
▶ ▼ ✨ AI Jobs (2)
ID Workflow Result Correct Bug Created Started Finished Revision
ecc0c4c9 repro-c 💥 kernel BUG in set_state_bits (2) 2026/08/07 14:14 2026/08/07 14:14 2026/08/07 19:11 e4ef95d6
e61cd430 assessment-security DenialOfService: ✅ Exploitable: ❌ FilesystemTrigger: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ✅ UserNamespace: ✅ VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ kernel BUG in set_state_bits (2) 2026/08/03 01:12 2026/08/03 01:12 2026/08/03 01:54 e611ffe1
▶ ▼ Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [btrfs?] kernel BUG in set_state_bits (2) 0 (1) 2026/08/06 00:13
▶ ▼ Similar bugs (3)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 kernel BUG in set_state_bits origin:upstream missing-backport -1 syz, C inconclusive 4 98d 523d 0/3 upstream: reported C repro on 2025/04/28 01:43
linux-5.15 kernel BUG in set_state_bits origin:upstream -1 syz, C error 21 10d 1278d 0/3 upstream: reported C repro on 2023/04/03 19:24
upstream kernel BUG in set_state_bits btrfs -1 syz, C done done 97 818d 1402d 0/29 auto-obsoleted due to no activity on 2025/11/10 23:39

Sample crash report:
loop0: detected capacity change from 0 to 32768
BTRFS warning: v1 space cache is deprecated, falling back to no space cache
BTRFS: device fsid 395ef67a-297e-477c-816d-cd80a5b93e5d devid 1 transid 8 /dev/loop0 (7:0) scanned by syz.0.0 (5316)
BTRFS info (device loop0): first mount of filesystem 395ef67a-297e-477c-816d-cd80a5b93e5d
BTRFS info (device loop0): using sha256 checksum algorithm
BTRFS info (device loop0): rebuilding free space tree
BTRFS info (device loop0): disabling free space tree
BTRFS info (device loop0): clearing compat-ro feature flag for FREE_SPACE_TREE (0x1)
BTRFS info (device loop0): clearing compat-ro feature flag for FREE_SPACE_TREE_VALID (0x2)
BTRFS info (device loop0): enabling ssd optimizations
BTRFS info (device loop0): force clearing of disk cache
BTRFS info (device loop0): enabling auto defrag
BTRFS info (device loop0): max_inline set to 0
FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 0, space 0, times 1
CPU: 0 UID: 0 PID: 5316 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
 fail_dump lib/fault-inject.c:73 [inline]
 should_fail_ex+0x410/0x560 lib/fault-inject.c:174
 should_failslab+0xa8/0x100 mm/failslab.c:46
 slab_pre_alloc_hook mm/slub.c:4638 [inline]
 slab_alloc_node mm/slub.c:4974 [inline]
 __kmalloc_cache_noprof+0xa3/0x600 mm/slub.c:5559
 _kmalloc_noprof include/linux/slab.h:991 [inline]
 ulist_add_merge+0x18d/0x4b0 fs/btrfs/ulist.c:222
 add_extent_changeset fs/btrfs/extent-io-tree.c:203 [inline]
 set_state_bits+0x1d3/0x3a0 fs/btrfs/extent-io-tree.c:415
 set_extent_bit+0x8f7/0x1c10 fs/btrfs/extent-io-tree.c:1238
 btrfs_set_record_extent_bits+0x50/0x90 fs/btrfs/extent-io-tree.c:1980
 qgroup_reserve_data+0x26e/0x8e0 fs/btrfs/qgroup.c:4279
 btrfs_qgroup_reserve_data+0x2e/0xb0 fs/btrfs/qgroup.c:4323
 btrfs_check_data_free_space+0x2e0/0x490 fs/btrfs/delalloc-space.c:166
 reserve_space fs/btrfs/file.c:1108 [inline]
 copy_one_range fs/btrfs/file.c:1205 [inline]
 btrfs_buffered_write+0x4b9/0x1660 fs/btrfs/file.c:1354
 btrfs_direct_write+0x59d/0xce0 fs/btrfs/direct-io.c:1036
 btrfs_do_write_iter+0x325/0x790 fs/btrfs/file.c:1427
 do_iter_readv_writev+0x612/0x8c0 fs/read_write.c:-1
 vfs_writev+0x343/0x990 fs/read_write.c:1058
 do_pwritev fs/read_write.c:1154 [inline]
 __do_sys_pwritev2 fs/read_write.c:1212 [inline]
 __se_sys_pwritev2+0x177/0x2a0 fs/read_write.c:1203
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f2b3bd9e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f2b3cc02fe8 EFLAGS: 00000246 ORIG_RAX: 0000000000000148
RAX: ffffffffffffffda RBX: 00007f2b3c025fa0 RCX: 00007f2b3bd9e159
RDX: 0000000000000001 RSI: 0000200000000240 RDI: 0000000000000006
RBP: 00007f2b3cc03050 R08: 0000000000000000 R09: 0000000000000003
R10: 0000000000002000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007f2b3c026038 R14: 00007f2b3c025fa0 R15: 00007ffc82d64938
 </TASK>
BTRFS critical (device loop0): panic in set_state_bits:417: extent io tree error on add_extent_changeset state start 32768 end 61439 (errno=-12 -ENOMEM)
------------[ cut here ]------------
kernel BUG at fs/btrfs/extent-io-tree.c:417!
Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI
CPU: 0 UID: 0 PID: 5316 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
RIP: 0010:set_state_bits+0x396/0x3a0 fs/btrfs/extent-io-tree.c:417
Code: d4 43 8e ba a1 01 00 00 44 89 e9 49 c7 c0 60 ec 5c 8c 49 c7 c1 c0 ec 5c 8c 48 8b 04 24 ff 30 53 e8 7f df e4 fc 48 83 c4 10 90 <0f> 0b 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90
RSP: 0018:ffffc9000dea7490 EFLAGS: 00010286
RAX: d9f7b48de6163500 RBX: 0000000000008000 RCX: dffffc0000000000
RDX: 0000000000000000 RSI: ffffffff8e6a36ef RDI: ffff8880333ea580
RBP: 0000000000000003 R08: ffff88801fc24713 R09: 1ffff11003f848e2
R10: dffffc0000000000 R11: ffffed1003f848e3 R12: ffff88800e944ad0
R13: 00000000fffffff4 R14: ffff888052930000 R15: 1ffff11001d28971
FS:  00007f2b3cc036c0(0000) GS:ffff88808c2bc000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000200000030000 CR3: 0000000033d14000 CR4: 0000000000352ef0
Call Trace:
 <TASK>
 set_extent_bit+0x8f7/0x1c10 fs/btrfs/extent-io-tree.c:1238
 btrfs_set_record_extent_bits+0x50/0x90 fs/btrfs/extent-io-tree.c:1980
 qgroup_reserve_data+0x26e/0x8e0 fs/btrfs/qgroup.c:4279
 btrfs_qgroup_reserve_data+0x2e/0xb0 fs/btrfs/qgroup.c:4323
 btrfs_check_data_free_space+0x2e0/0x490 fs/btrfs/delalloc-space.c:166
 reserve_space fs/btrfs/file.c:1108 [inline]
 copy_one_range fs/btrfs/file.c:1205 [inline]
 btrfs_buffered_write+0x4b9/0x1660 fs/btrfs/file.c:1354
 btrfs_direct_write+0x59d/0xce0 fs/btrfs/direct-io.c:1036
 btrfs_do_write_iter+0x325/0x790 fs/btrfs/file.c:1427
 do_iter_readv_writev+0x612/0x8c0 fs/read_write.c:-1
 vfs_writev+0x343/0x990 fs/read_write.c:1058
 do_pwritev fs/read_write.c:1154 [inline]
 __do_sys_pwritev2 fs/read_write.c:1212 [inline]
 __se_sys_pwritev2+0x177/0x2a0 fs/read_write.c:1203
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f2b3bd9e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f2b3cc02fe8 EFLAGS: 00000246 ORIG_RAX: 0000000000000148
RAX: ffffffffffffffda RBX: 00007f2b3c025fa0 RCX: 00007f2b3bd9e159
RDX: 0000000000000001 RSI: 0000200000000240 RDI: 0000000000000006
RBP: 00007f2b3cc03050 R08: 0000000000000000 R09: 0000000000000003
R10: 0000000000002000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007f2b3c026038 R14: 00007f2b3c025fa0 R15: 00007ffc82d64938
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:set_state_bits+0x396/0x3a0 fs/btrfs/extent-io-tree.c:417
Code: d4 43 8e ba a1 01 00 00 44 89 e9 49 c7 c0 60 ec 5c 8c 49 c7 c1 c0 ec 5c 8c 48 8b 04 24 ff 30 53 e8 7f df e4 fc 48 83 c4 10 90 <0f> 0b 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90
RSP: 0018:ffffc9000dea7490 EFLAGS: 00010286
RAX: d9f7b48de6163500 RBX: 0000000000008000 RCX: dffffc0000000000
RDX: 0000000000000000 RSI: ffffffff8e6a36ef RDI: ffff8880333ea580
RBP: 0000000000000003 R08: ffff88801fc24713 R09: 1ffff11003f848e2
R10: dffffc0000000000 R11: ffffed1003f848e3 R12: ffff88800e944ad0
R13: 00000000fffffff4 R14: ffff888052930000 R15: 1ffff11001d28971
FS:  00007f2b3cc036c0(0000) GS:ffff88808c2bc000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000200000030000 CR3: 0000000033d14000 CR4: 0000000000352ef0

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/09/30 13:05 upstream 551c722f4080 7808aef4 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root kernel BUG in set_state_bits
2026/08/01 15:16 upstream 02dc699f83d0 e611ffe1 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root kernel BUG in set_state_bits
2026/08/01 15:16 upstream 02dc699f83d0 e611ffe1 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root kernel BUG in set_state_bits
* Struck through repros no longer work on HEAD.