general protection fault in write_all_supers

Status: upstream: reported C repro on 2025/07/26 11:00
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+1df6dc78b7815d4d1974@syzkaller.appspotmail.com
First crash: 376d, last: 39d
Fix commit to backport (bisect log) :
tree: upstream
commit ad21f15b0f795daf8723dddbcb61797d4f1c2aed
Author: Josef Bacik <josef@toxicpanda.com>
Date: Wed Nov 22 17:17:50 2023 +0000

  btrfs: switch to the new mount API

  
Fix bisection: the issue occurs on the latest tested release (bisect log)
Crash: BUG: unable to handle kernel NULL pointer dereference in write_all_supers (log)
Repro: C syz .config
  
Bug presence (2)
Date Name Commit Repro Result
2025/07/28 linux-6.6.y (ToT) dbcb8d8e4163 C [report] general protection fault in write_all_supers
2025/07/27 upstream (ToT) 038d61fd6422 C Didn't crash
Similar bugs (3)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 BUG: unable to handle kernel paging request in write_all_supers origin:upstream 8 syz, C error 13 12d 670d 0/3 upstream: reported C repro on 2024/10/04 18:21
upstream general protection fault in write_all_supers btrfs 8 syz, C 21 651d 694d 28/29 fixed on 2024/11/12 23:31
linux-6.1 BUG: unable to handle kernel paging request in write_all_supers origin:upstream missing-backport 8 syz, C inconclusive 58 52d 389d 0/3 upstream: reported C repro on 2025/07/13 03:08
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2025/09/30 10:47 4h29m fix candidate upstream OK (1) job log
2025/09/08 09:50 1h58m bisect fix linux-6.6.y OK (0) job log log

Sample crash report:
workqueue: max_active 2097158 requested for btrfs-compressed-write is out of range, clamping between 1 and 512
BTRFS info (device loop0: state C): enabling ssd optimizations
BTRFS error (device loop0: state MC): unrecognized mount option 'L'
general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
CPU: 0 PID: 5932 Comm: syz.0.17 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/09/2026
RIP: 0010:backup_super_roots fs/btrfs/disk-io.c:1649 [inline]
RIP: 0010:write_all_supers+0x8c9/0x3f20 fs/btrfs/disk-io.c:4075
Code: 00 00 00 48 89 d8 48 c1 e8 03 42 0f b6 04 20 84 c0 0f 85 fe 33 00 00 44 88 33 48 8b 5c 24 10 48 83 c3 18 48 89 d8 48 c1 e8 03 <42> 80 3c 20 00 74 08 48 89 df e8 28 2a 61 fe 48 89 5c 24 10 48 8b
RSP: 0018:ffffc900032c7400 EFLAGS: 00010206
RAX: 0000000000000003 RBX: 0000000000000018 RCX: 0000000000000000
RDX: 0000000000000001 RSI: 0000000000000004 RDI: ffff888027140a50
RBP: ffffc900032c77b0 R08: ffff88802778006b R09: 1ffff11004ef000d
R10: dffffc0000000000 R11: ffffed1004ef000e R12: dffffc0000000000
R13: ffff88802e5fab2b R14: 0000000000000000 R15: ffff88802abfc018
FS:  000055557999b500(0000) GS:ffff8880b8e00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2cc63fff CR3: 000000002bd6b000 CR4: 00000000003506f0
Call Trace:
 <TASK>
 btrfs_commit_transaction+0x1cc5/0x3500 fs/btrfs/transaction.c:2526
 btrfs_set_free_space_cache_v1_active+0x71/0x1c0 fs/btrfs/free-space-cache.c:4156
 btrfs_remount_cleanup fs/btrfs/super.c:1684 [inline]
 btrfs_remount+0x74d/0x1630 fs/btrfs/super.c:1880
 reconfigure_super+0x229/0x8e0 fs/super.c:1151
 do_remount fs/namespace.c:2927 [inline]
 path_mount+0xcfe/0xfa0 fs/namespace.c:3705
 do_mount fs/namespace.c:3726 [inline]
 __do_sys_mount fs/namespace.c:3935 [inline]
 __se_sys_mount+0x2e7/0x3d0 fs/namespace.c:3912
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fc45059e0ca
Code: 48 c7 c2 e8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 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:00007fff9ec1a338 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fff9ec1a3c0 RCX: 00007fc45059e0ca
RDX: 0000200000000180 RSI: 0000200000000380 RDI: 0000000000000000
RBP: 0000200000000180 R08: 00007fff9ec1a3c0 R09: 0000000002042023
R10: 0000000002042023 R11: 0000000000000246 R12: 0000200000000380
R13: 00007fff9ec1a380 R14: 0000000000000000 R15: 00002000000002c0
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:backup_super_roots fs/btrfs/disk-io.c:1649 [inline]
RIP: 0010:write_all_supers+0x8c9/0x3f20 fs/btrfs/disk-io.c:4075
Code: 00 00 00 48 89 d8 48 c1 e8 03 42 0f b6 04 20 84 c0 0f 85 fe 33 00 00 44 88 33 48 8b 5c 24 10 48 83 c3 18 48 89 d8 48 c1 e8 03 <42> 80 3c 20 00 74 08 48 89 df e8 28 2a 61 fe 48 89 5c 24 10 48 8b
RSP: 0018:ffffc900032c7400 EFLAGS: 00010206
RAX: 0000000000000003 RBX: 0000000000000018 RCX: 0000000000000000
RDX: 0000000000000001 RSI: 0000000000000004 RDI: ffff888027140a50
RBP: ffffc900032c77b0 R08: ffff88802778006b R09: 1ffff11004ef000d
R10: dffffc0000000000 R11: ffffed1004ef000e R12: dffffc0000000000
R13: ffff88802e5fab2b R14: 0000000000000000 R15: ffff88802abfc018
FS:  000055557999b500(0000) GS:ffff8880b8e00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2cc63fff CR3: 000000002bd6b000 CR4: 00000000003506f0
----------------
Code disassembly (best guess):
   0:	00 00                	add    %al,(%rax)
   2:	00 48 89             	add    %cl,-0x77(%rax)
   5:	d8 48 c1             	fmuls  -0x3f(%rax)
   8:	e8 03 42 0f b6       	call   0xb60f4210
   d:	04 20                	add    $0x20,%al
   f:	84 c0                	test   %al,%al
  11:	0f 85 fe 33 00 00    	jne    0x3415
  17:	44 88 33             	mov    %r14b,(%rbx)
  1a:	48 8b 5c 24 10       	mov    0x10(%rsp),%rbx
  1f:	48 83 c3 18          	add    $0x18,%rbx
  23:	48 89 d8             	mov    %rbx,%rax
  26:	48 c1 e8 03          	shr    $0x3,%rax
* 2a:	42 80 3c 20 00       	cmpb   $0x0,(%rax,%r12,1) <-- trapping instruction
  2f:	74 08                	je     0x39
  31:	48 89 df             	mov    %rbx,%rdi
  34:	e8 28 2a 61 fe       	call   0xfe612a61
  39:	48 89 5c 24 10       	mov    %rbx,0x10(%rsp)
  3e:	48                   	rex.W
  3f:	8b                   	.byte 0x8b

Crashes (10):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/06/27 19:22 linux-6.6.y d1cfde2d5d15 fb92f11c .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci2-linux-6-6-kasan general protection fault in write_all_supers
2025/12/28 21:06 linux-6.6.y 5fa4793a2d2d d6526ea3 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci2-linux-6-6-kasan general protection fault in write_all_supers
2025/07/26 14:25 linux-6.6.y dbcb8d8e4163 fb8f743d .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci2-linux-6-6-kasan general protection fault in write_all_supers
2025/07/26 13:35 linux-6.6.y dbcb8d8e4163 fb8f743d .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci2-linux-6-6-kasan general protection fault in write_all_supers
2025/07/26 12:41 linux-6.6.y dbcb8d8e4163 fb8f743d .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci2-linux-6-6-kasan general protection fault in write_all_supers
2025/07/26 11:50 linux-6.6.y dbcb8d8e4163 fb8f743d .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci2-linux-6-6-kasan general protection fault in write_all_supers
2025/12/28 20:24 linux-6.6.y 5fa4793a2d2d d6526ea3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan general protection fault in write_all_supers
2025/08/02 12:40 linux-6.6.y 3a8ababb8b6a 7368264b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan general protection fault in write_all_supers
2025/07/26 11:00 linux-6.6.y dbcb8d8e4163 fb8f743d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan general protection fault in write_all_supers
2025/07/26 10:59 linux-6.6.y dbcb8d8e4163 fb8f743d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan general protection fault in write_all_supers
* Struck through repros no longer work on HEAD.