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

Crash report:
bcachefs (loop0): accounting_read... done
bcachefs (loop0): alloc_read...
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
CPU: 0 UID: 0 PID: 5100 Comm: syz-executor420 Not tainted 6.11.0-syzkaller-08481-g88264981f208 #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_alloc_read+0x17d9/0x24f0 fs/bcachefs/alloc_background.c:625
Code: 0f b6 04 10 84 c0 4c 8d a4 24 b0 02 00 00 49 89 d7 0f 85 78 04 00 00 48 8b 33 48 8b 3c 24 e8 5e 14 00 00 48 89 c3 48 c1 e8 03 <42> 0f b6 04 38 84 c0 0f 85 74 04 00 00 0f b6 44 24 30 88 03 48 8b
RSP: 0018:ffffc90002d8f0e0 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff89011e18963c
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 0000008100000014
RBP: ffffc90002d8f4c8 R08: ffffffff8409ef0e R09: 0000000000000000
R10: ffffc90002d8f450 R11: fffff520005b1e8c R12: ffffc90002d8f390
R13: 000000000000001c R14: ffffc90002d8f200 R15: dffffc0000000000
FS:  00005555882c4380(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000558280275240 CR3: 000000001205e000 CR4: 0000000000350ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 bch2_run_recovery_pass+0xf0/0x1e0 fs/bcachefs/recovery_passes.c:183
 bch2_run_recovery_passes+0x19e/0x820 fs/bcachefs/recovery_passes.c:230
 bch2_fs_recovery+0x24f9/0x38b0 fs/bcachefs/recovery.c:859
 bch2_fs_start+0x356/0x5b0 fs/bcachefs/super.c:1036
 bch2_fs_get_tree+0xd61/0x1700 fs/bcachefs/fs.c:1956
 vfs_get_tree+0x90/0x2b0 fs/super.c:1800
 do_new_mount+0x2be/0xb40 fs/namespace.c:3507
 do_mount fs/namespace.c:3847 [inline]
 __do_sys_mount fs/namespace.c:4055 [inline]
 __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:4032
 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:0x7f0c704b9dea
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:00007ffd5754dfb8 EFLAGS: 00000282 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffd5754dfd0 RCX: 00007f0c704b9dea
RDX: 00000000200058c0 RSI: 0000000020005900 RDI: 00007ffd5754dfd0
RBP: 0000000000000004 R08: 00007ffd5754e010 R09: 002c61746f757172
R10: 0000000000000000 R11: 0000000000000282 R12: 0000000000000000
R13: 00007ffd5754e010 R14: 0000000000000003 R15: 0000000001000000
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:bch2_alloc_read+0x17d9/0x24f0 fs/bcachefs/alloc_background.c:625
Code: 0f b6 04 10 84 c0 4c 8d a4 24 b0 02 00 00 49 89 d7 0f 85 78 04 00 00 48 8b 33 48 8b 3c 24 e8 5e 14 00 00 48 89 c3 48 c1 e8 03 <42> 0f b6 04 38 84 c0 0f 85 74 04 00 00 0f b6 44 24 30 88 03 48 8b
RSP: 0018:ffffc90002d8f0e0 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff89011e18963c
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 0000008100000014
RBP: ffffc90002d8f4c8 R08: ffffffff8409ef0e R09: 0000000000000000
R10: ffffc90002d8f450 R11: fffff520005b1e8c R12: ffffc90002d8f390
R13: 000000000000001c R14: ffffc90002d8f200 R15: dffffc0000000000
FS:  00005555882c4380(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f4c02468cda CR3: 000000001205e000 CR4: 0000000000350ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	0f b6 04 10          	movzbl (%rax,%rdx,1),%eax
   4:	84 c0                	test   %al,%al
   6:	4c 8d a4 24 b0 02 00 	lea    0x2b0(%rsp),%r12
   d:	00
   e:	49 89 d7             	mov    %rdx,%r15
  11:	0f 85 78 04 00 00    	jne    0x48f
  17:	48 8b 33             	mov    (%rbx),%rsi
  1a:	48 8b 3c 24          	mov    (%rsp),%rdi
  1e:	e8 5e 14 00 00       	call   0x1481
  23:	48 89 c3             	mov    %rax,%rbx
  26:	48 c1 e8 03          	shr    $0x3,%rax
* 2a:	42 0f b6 04 38       	movzbl (%rax,%r15,1),%eax <-- trapping instruction
  2f:	84 c0                	test   %al,%al
  31:	0f 85 74 04 00 00    	jne    0x4ab
  37:	0f b6 44 24 30       	movzbl 0x30(%rsp),%eax
  3c:	88 03                	mov    %al,(%rbx)
  3e:	48                   	rex.W
  3f:	8b                   	.byte 0x8b