Kernel bug: general protection fault in bch2_fs_recovery
Subsystem: bcachefs
Status: fixed

Crash report:
bcachefs (loop0): starting version 1.7: mi_btree_bitmap opts=errors=continue,metadata_checksum=xxhash,data_checksum=none,compression=lz4,background_compression=lz4,erasure_code,noinodes_use_key_cache,grpquota,nojournal_transaction_names,nocow
superblock marked clean but clean section not present, fixing
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000002: 0000 [#1] PREEMPT SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017]
CPU: 0 UID: 0 PID: 5108 Comm: syz-executor340 Not tainted 6.11.0-rc7-syzkaller-00017-gbc83b4d1f086 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
RIP: 0010:bch2_fs_recovery+0x274/0x38b0 fs/bcachefs/recovery.c:644
Code: 00 00 4c 89 f7 48 c7 c6 20 72 54 8c e8 85 d6 05 00 eb 41 e8 6e 55 55 fd 49 8d 9d cc 01 00 00 49 83 c7 10 4c 89 f8 48 c1 e8 03 <42> 80 3c 20 00 74 08 4c 89 ff e8 fd 9c bc fd 49 8b 0f 4c 89 ef 48
RSP: 0018:ffffc90002e4f5c0 EFLAGS: 00010202
RAX: 0000000000000002 RBX: ffff8880441801cc RCX: ffff88801fd34880
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90002e4f968 R08: ffffffff843e3700 R09: 1ffff920005c9e9c
R10: dffffc0000000000 R11: fffff520005c9e9d R12: dffffc0000000000
R13: ffff888044180000 R14: ffff888044180777 R15: 0000000000000010
FS:  000055555e2a1380(0000) GS:ffff88801fe00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000561b4e028808 CR3: 0000000036192000 CR4: 0000000000350ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 bch2_fs_start+0x356/0x5b0 fs/bcachefs/super.c:1036
 bch2_fs_get_tree+0xd61/0x1700 fs/bcachefs/fs.c:1954
 vfs_get_tree+0x90/0x2b0 fs/super.c:1800
 do_new_mount+0x2be/0xb40 fs/namespace.c:3472
 do_mount fs/namespace.c:3812 [inline]
 __do_sys_mount fs/namespace.c:4020 [inline]
 __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3997
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f6adfe3626a
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 5e 04 00 00 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff810bb308 EFLAGS: 00000282 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fff810bb320 RCX: 00007f6adfe3626a
RDX: 00000000200058c0 RSI: 0000000020000080 RDI: 00007fff810bb320
RBP: 0000000000000004 R08: 00007fff810bb360 R09: 0000000000005905
R10: 0000000000008000 R11: 0000000000000282 R12: 0000000000008000
R13: 00007fff810bb360 R14: 0000000000000003 R15: 0000000001000000
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:bch2_fs_recovery+0x274/0x38b0 fs/bcachefs/recovery.c:644
Code: 00 00 4c 89 f7 48 c7 c6 20 72 54 8c e8 85 d6 05 00 eb 41 e8 6e 55 55 fd 49 8d 9d cc 01 00 00 49 83 c7 10 4c 89 f8 48 c1 e8 03 <42> 80 3c 20 00 74 08 4c 89 ff e8 fd 9c bc fd 49 8b 0f 4c 89 ef 48
RSP: 0018:ffffc90002e4f5c0 EFLAGS: 00010202
RAX: 0000000000000002 RBX: ffff8880441801cc RCX: ffff88801fd34880
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90002e4f968 R08: ffffffff843e3700 R09: 1ffff920005c9e9c
R10: dffffc0000000000 R11: fffff520005c9e9d R12: dffffc0000000000
R13: ffff888044180000 R14: ffff888044180777 R15: 0000000000000010
FS:  000055555e2a1380(0000) GS:ffff88801fe00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000561b4e028808 CR3: 0000000036192000 CR4: 0000000000350ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	00 00                	add    %al,(%rax)
   2:	4c 89 f7             	mov    %r14,%rdi
   5:	48 c7 c6 20 72 54 8c 	mov    $0xffffffff8c547220,%rsi
   c:	e8 85 d6 05 00       	call   0x5d696
  11:	eb 41                	jmp    0x54
  13:	e8 6e 55 55 fd       	call   0xfd555586
  18:	49 8d 9d cc 01 00 00 	lea    0x1cc(%r13),%rbx
  1f:	49 83 c7 10          	add    $0x10,%r15
  23:	4c 89 f8             	mov    %r15,%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:	4c 89 ff             	mov    %r15,%rdi
  34:	e8 fd 9c bc fd       	call   0xfdbc9d36
  39:	49 8b 0f             	mov    (%r15),%rcx
  3c:	4c 89 ef             	mov    %r13,%rdi
  3f:	48                   	rex.W