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: 97d, last: 4d19h
▶ ▼ ✨ 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 (2)
Title Replies (including bot) Last reply
[syzbot] Monthly btrfs report (Nov 2026) 0 (1) 2026/11/06 12:33
[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 132d 557d 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 44d 1312d 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 852d 1436d 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 (5360)
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: 5360 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:74 [inline]
 should_fail_ex+0x3eb/0x540 lib/fault-inject.c:175
 should_failslab+0xa8/0x100 mm/failslab.c:46
 slab_pre_alloc_hook mm/slub.c:4675 [inline]
 slab_alloc_node mm/slub.c:5011 [inline]
 __kmalloc_cache_noprof+0x9e/0x600 mm/slub.c:5676
 _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+0x8f2/0x1c00 fs/btrfs/extent-io-tree.c:1238
 btrfs_set_record_extent_bits+0x50/0x90 fs/btrfs/extent-io-tree.c:1980
 qgroup_reserve_data+0x2a4/0x930 fs/btrfs/qgroup.c:4319
 btrfs_qgroup_reserve_data+0x2e/0xb0 fs/btrfs/qgroup.c:4363
 btrfs_check_data_free_space+0x25e/0x3f0 fs/btrfs/delalloc-space.c:162
 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+0x675/0xd50 fs/btrfs/direct-io.c:1043
 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+0x1a9/0x2d0 fs/read_write.c:1153
 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:0x7f513479f559
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:00007f513574dfe8 EFLAGS: 00000246 ORIG_RAX: 0000000000000148
RAX: ffffffffffffffda RBX: 00007f5134a25fa0 RCX: 00007f513479f559
RDX: 0000000000000001 RSI: 0000200000042c00 RDI: 0000000000000008
RBP: 00007f513574e050 R08: 0000000000000000 R09: 0000000000000003
R10: 0000000000002000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007f5134a26038 R14: 00007f5134a25fa0 R15: 00007ffcd77de1e8
 </TASK>
BTRFS critical (device loop0): panic in set_state_bits:417: extent io tree error on add_extent_changeset state start 225280 end 229375 (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: 5360 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: 17 6d 8e ba a1 01 00 00 44 89 e9 49 c7 c0 c0 bb 7d 8c 49 c7 c1 20 bc 7d 8c 48 8b 04 24 ff 30 53 e8 bf 76 d7 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:ffffc9000e0c7490 EFLAGS: 00010286
RAX: 9ffb9b90cd37ce00 RBX: 0000000000037000 RCX: dffffc0000000000
RDX: 0000000000000000 RSI: ffffffff8e9399e2 RDI: ffff888036308000
RBP: 0000000000000003 R08: ffffffff9014c68b R09: 1ffffffff20298d1
R10: dffffc0000000000 R11: fffffbfff20298d2 R12: ffff888045b64ad0
R13: 00000000fffffff4 R14: ffff8880549fc000 R15: 1ffff11008b6c971
FS:  00007f513574e6c0(0000) GS:ffff88808aa01000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000200000080000 CR3: 000000005483b000 CR4: 0000000000352ef0
Call Trace:
 <TASK>
 set_extent_bit+0x8f2/0x1c00 fs/btrfs/extent-io-tree.c:1238
 btrfs_set_record_extent_bits+0x50/0x90 fs/btrfs/extent-io-tree.c:1980
 qgroup_reserve_data+0x2a4/0x930 fs/btrfs/qgroup.c:4319
 btrfs_qgroup_reserve_data+0x2e/0xb0 fs/btrfs/qgroup.c:4363
 btrfs_check_data_free_space+0x25e/0x3f0 fs/btrfs/delalloc-space.c:162
 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+0x675/0xd50 fs/btrfs/direct-io.c:1043
 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+0x1a9/0x2d0 fs/read_write.c:1153
 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:0x7f513479f559
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:00007f513574dfe8 EFLAGS: 00000246 ORIG_RAX: 0000000000000148
RAX: ffffffffffffffda RBX: 00007f5134a25fa0 RCX: 00007f513479f559
RDX: 0000000000000001 RSI: 0000200000042c00 RDI: 0000000000000008
RBP: 00007f513574e050 R08: 0000000000000000 R09: 0000000000000003
R10: 0000000000002000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007f5134a26038 R14: 00007f5134a25fa0 R15: 00007ffcd77de1e8
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:set_state_bits+0x396/0x3a0 fs/btrfs/extent-io-tree.c:417
Code: 17 6d 8e ba a1 01 00 00 44 89 e9 49 c7 c0 c0 bb 7d 8c 49 c7 c1 20 bc 7d 8c 48 8b 04 24 ff 30 53 e8 bf 76 d7 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:ffffc9000e0c7490 EFLAGS: 00010286
RAX: 9ffb9b90cd37ce00 RBX: 0000000000037000 RCX: dffffc0000000000
RDX: 0000000000000000 RSI: ffffffff8e9399e2 RDI: ffff888036308000
RBP: 0000000000000003 R08: ffffffff9014c68b R09: 1ffffffff20298d1
R10: dffffc0000000000 R11: fffffbfff20298d2 R12: ffff888045b64ad0
R13: 00000000fffffff4 R14: ffff8880549fc000 R15: 1ffff11008b6c971
FS:  00007f513574e6c0(0000) GS:ffff88808aa01000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000200000080000 CR3: 000000005483b000 CR4: 0000000000352ef0

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/01 23:56 upstream 46fec1c3029b 25a0ae84 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root kernel BUG in set_state_bits
2026/11/01 23:40 upstream 46fec1c3029b 25a0ae84 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root kernel BUG in set_state_bits
2026/10/23 21:39 upstream 734bef548a96 1d9ca40b .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root kernel BUG in set_state_bits
2026/10/08 01:39 upstream 7b63ef2d55f2 4f6a9fcf .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root kernel BUG in set_state_bits
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.