syzbot


general protection fault in btrfs_search_slot

Status: upstream: reported C repro on 2024/10/24 03:50
Subsystems: btrfs
[Documentation on labels]
Reported-by: syzbot+3030e17bd57a73d39bd7@syzkaller.appspotmail.com
Fix commit: 3ed51857a50f btrfs: add a sanity check for btrfs root in btrfs_search_slot()
Patched on: [ci-qemu-gce-upstream-auto ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-snapshot-upstream-root ci-upstream-gce-leak ci-upstream-kasan-badwrites-root ci-upstream-kasan-gce ci-upstream-kasan-gce-386 ci-upstream-kasan-gce-root ci-upstream-kasan-gce-selinux-root ci-upstream-kasan-gce-smack-root ci-upstream-kmsan-gce-386-root ci-upstream-kmsan-gce-root ci-upstream-linux-next-kasan-gce-root ci2-upstream-fs ci2-upstream-kcsan-gce], missing on: [ci-qemu-native-arm64-kvm ci-qemu2-arm32 ci-qemu2-riscv64 ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-arm64 ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-usb]
First crash: 46d, last: 3d10h
Cause bisection: introduced by (bisect log) :
commit 42437a6386ffeaaf200731e73d723ea491f3fe7d
Author: Josef Bacik <josef@toxicpanda.com>
Date: Fri Oct 16 15:29:18 2020 +0000

  btrfs: introduce mount option rescue=ignorebadroots

Crash: BUG: unable to handle kernel NULL pointer dereference in btrfs_root_node (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[syzbot] [btrfs?] general protection fault in btrfs_search_slot 4 (8) 2024/11/03 21:44
[PATCH] btrfs: add a sanity check for btrfs root 5 (5) 2024/10/25 22:22
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in btrfs_search_slot btrfs C 7 641d 706d 0/1 upstream: reported C repro on 2022/12/29 23:26
Last patch testing requests (6)
Created Duration User Patch Repo Result
2024/12/02 02:18 54m retest repro upstream report log
2024/12/02 02:18 12m retest repro upstream report log
2024/11/17 22:24 13m retest repro upstream report log
2024/11/17 22:24 13m retest repro upstream report log
2024/10/25 04:39 19m lizhi.xu@windriver.com patch upstream OK log
2024/10/25 02:23 19m lizhi.xu@windriver.com patch upstream OK log

Sample crash report:
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000041: 0000 [#1] PREEMPT SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000208-0x000000000000020f]
CPU: 0 UID: 0 PID: 5828 Comm: syz-executor406 Not tainted 6.12.0-rc5-syzkaller-00308-g3e5e6c9900c3 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
RIP: 0010:btrfs_search_slot+0xc5/0x30d0 fs/btrfs/ctree.c:2013
Code: 08 43 c7 44 2c 10 04 f2 04 f3 e8 76 f9 e9 fd 48 89 5c 24 38 48 81 c3 08 02 00 00 48 89 d8 48 c1 e8 03 48 89 84 24 d0 00 00 00 <42> 80 3c 28 00 74 08 48 89 df e8 5c 94 50 fe 48 8b 03 48 89 84 24
RSP: 0018:ffffc90003ce79e0 EFLAGS: 00010206
RAX: 0000000000000041 RBX: 0000000000000208 RCX: ffff88805dfa0000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90003ce7bb0 R08: 0000000000000000 R09: 0000000000000000
R10: dffffc0000000000 R11: ffffed100f66e00e R12: 1ffff9200079cf58
R13: dffffc0000000000 R14: 0000000000000000 R15: ffff88807f3ce840
FS:  000055558e474380(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055fc3137d620 CR3: 000000005d402000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 extent_from_logical+0x1c8/0x880 fs/btrfs/backref.c:2216
 iterate_inodes_from_logical+0x13b/0x330 fs/btrfs/backref.c:2560
 btrfs_ioctl_logical_to_ino+0x133/0x2a0 fs/btrfs/ioctl.c:3489
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:907 [inline]
 __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893
 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:0x7f92745f8839
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 17 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff3b6029f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fff3b602bc8 RCX: 00007f92745f8839
RDX: 0000000020000080 RSI: 00000000c0389424 RDI: 0000000000000004
RBP: 00007f9274670610 R08: 0000000000000000 R09: 00007fff3b602bc8
R10: 000000000000002e R11: 0000000000000246 R12: 0000000000000001
R13: 00007fff3b602bb8 R14: 0000000000000001 R15: 0000000000000001
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:btrfs_search_slot+0xc5/0x30d0 fs/btrfs/ctree.c:2013
Code: 08 43 c7 44 2c 10 04 f2 04 f3 e8 76 f9 e9 fd 48 89 5c 24 38 48 81 c3 08 02 00 00 48 89 d8 48 c1 e8 03 48 89 84 24 d0 00 00 00 <42> 80 3c 28 00 74 08 48 89 df e8 5c 94 50 fe 48 8b 03 48 89 84 24
RSP: 0018:ffffc90003ce79e0 EFLAGS: 00010206
RAX: 0000000000000041 RBX: 0000000000000208 RCX: ffff88805dfa0000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90003ce7bb0 R08: 0000000000000000 R09: 0000000000000000
R10: dffffc0000000000 R11: ffffed100f66e00e R12: 1ffff9200079cf58
R13: dffffc0000000000 R14: 0000000000000000 R15: ffff88807f3ce840
FS:  000055558e474380(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055fc3137d620 CR3: 000000005d402000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	08 43 c7             	or     %al,-0x39(%rbx)
   3:	44 2c 10             	rex.R sub $0x10,%al
   6:	04 f2                	add    $0xf2,%al
   8:	04 f3                	add    $0xf3,%al
   a:	e8 76 f9 e9 fd       	call   0xfde9f985
   f:	48 89 5c 24 38       	mov    %rbx,0x38(%rsp)
  14:	48 81 c3 08 02 00 00 	add    $0x208,%rbx
  1b:	48 89 d8             	mov    %rbx,%rax
  1e:	48 c1 e8 03          	shr    $0x3,%rax
  22:	48 89 84 24 d0 00 00 	mov    %rax,0xd0(%rsp)
  29:	00
* 2a:	42 80 3c 28 00       	cmpb   $0x0,(%rax,%r13,1) <-- trapping instruction
  2f:	74 08                	je     0x39
  31:	48 89 df             	mov    %rbx,%rdi
  34:	e8 5c 94 50 fe       	call   0xfe509495
  39:	48 8b 03             	mov    (%rbx),%rax
  3c:	48                   	rex.W
  3d:	89                   	.byte 0x89
  3e:	84                   	.byte 0x84
  3f:	24                   	.byte 0x24

Crashes (9):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/03 10:26 upstream 3e5e6c9900c3 f00eed24 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs general protection fault in btrfs_search_slot
2024/11/03 10:07 upstream 3e5e6c9900c3 f00eed24 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs general protection fault in btrfs_search_slot
2024/10/20 04:12 upstream 715ca9dd687f cd6fc0a3 .config console log report syz / log C [disk image (non-bootable)] [vmlinux] [kernel image] [mounted in repro] ci-snapshot-upstream-root general protection fault in btrfs_search_slot
2024/10/20 03:55 upstream 715ca9dd687f cd6fc0a3 .config console log report syz / log C [disk image (non-bootable)] [vmlinux] [kernel image] [mounted in repro] ci-snapshot-upstream-root general protection fault in btrfs_search_slot
2024/11/03 22:20 upstream a33ab3f94f51 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs general protection fault in btrfs_search_slot
2024/11/02 04:12 upstream 6c52d4da1c74 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs general protection fault in btrfs_search_slot
2024/11/01 10:15 upstream 6c52d4da1c74 96eb609f .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs general protection fault in btrfs_search_slot
2024/10/25 14:28 upstream ae90f6a6170d 2a61f980 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root general protection fault in btrfs_search_slot
2024/10/20 03:39 upstream 715ca9dd687f cd6fc0a3 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root general protection fault in btrfs_search_slot
* Struck through repros no longer work on HEAD.