syzbot


kernel BUG in btrfs_free_tree_block

Status: upstream: reported C repro on 2022/09/26 17:49
Reported-by: syzbot+a306f914b4d01b3958fe@syzkaller.appspotmail.com
First crash: 74d, last: 1h44m

Cause bisection: failed (bisect log)

Sample crash report:
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc7c859448 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f2da3ceea89
RDX: 000000000000275a RSI: 0000000020000040 RDI: 00000000ffffff9c
RBP: 00007ffc7c859470 R08: 0000000000000002 R09: 00007ffc7c859480
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000004
R13: 00007ffc7c8594b0 R14: 00007ffc7c859490 R15: 0000000000000003
 </TASK>
------------[ cut here ]------------
kernel BUG at fs/btrfs/extent-tree.c:3274!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 3705 Comm: syz-executor265 Not tainted 6.1.0-rc8-syzkaller-00045-gce19275f0103 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
RIP: 0010:btrfs_free_tree_block+0x266/0xc90 fs/btrfs/extent-tree.c:3274
Code: 00 48 8b 74 24 10 31 d2 4c 89 e7 e8 a4 48 17 00 31 ff 89 c6 89 44 24 10 e8 e7 af 23 fe 8b 44 24 10 85 c0 74 26 e8 2a b3 23 fe <0f> 0b e8 23 b3 23 fe 48 89 ee 48 c7 c7 fa ff ff ff c6 44 24 58 01
RSP: 0018:ffffc90003f3f1a8 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff888077ff5550 RCX: 0000000000000000
RDX: ffff888079823a80 RSI: ffffffff835c6ad6 RDI: 0000000000000005
RBP: 0000000000000005 R08: 0000000000000005 R09: 0000000000000000
R10: 00000000fffffff4 R11: 0000000000000000 R12: ffff888070c82498
R13: 1ffff920007e7e39 R14: 0000000000000001 R15: ffff88807988c000
FS:  0000555556352300(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000563fb2999ac0 CR3: 0000000027d0e000 CR4: 0000000000350ef0
Call Trace:
 <TASK>
 __btrfs_cow_block+0xbc4/0x1430 fs/btrfs/ctree.c:505
 btrfs_cow_block+0x2fa/0x950 fs/btrfs/ctree.c:588
 btrfs_search_slot+0x11b0/0x2c70 fs/btrfs/ctree.c:2025
 btrfs_insert_empty_items+0xbd/0x1c0 fs/btrfs/ctree.c:4119
 btrfs_create_new_inode+0x8be/0x27a0 fs/btrfs/inode.c:6410
 btrfs_create_common+0x1d5/0x260 fs/btrfs/inode.c:6639
 btrfs_create+0x116/0x160 fs/btrfs/inode.c:6679
 lookup_open.isra.0+0xf05/0x12a0 fs/namei.c:3413
 open_last_lookups fs/namei.c:3481 [inline]
 path_openat+0x996/0x2860 fs/namei.c:3711
 do_filp_open+0x1ba/0x410 fs/namei.c:3741
 do_sys_openat2+0x16d/0x4c0 fs/open.c:1310
 do_sys_open fs/open.c:1326 [inline]
 __do_sys_openat fs/open.c:1342 [inline]
 __se_sys_openat fs/open.c:1337 [inline]
 __x64_sys_openat+0x143/0x1f0 fs/open.c:1337
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f2da3ceea89
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc7c859448 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f2da3ceea89
RDX: 000000000000275a RSI: 0000000020000040 RDI: 00000000ffffff9c
RBP: 00007ffc7c859470 R08: 0000000000000002 R09: 00007ffc7c859480
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000004
R13: 00007ffc7c8594b0 R14: 00007ffc7c859490 R15: 0000000000000003
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:btrfs_free_tree_block+0x266/0xc90 fs/btrfs/extent-tree.c:3274
Code: 00 48 8b 74 24 10 31 d2 4c 89 e7 e8 a4 48 17 00 31 ff 89 c6 89 44 24 10 e8 e7 af 23 fe 8b 44 24 10 85 c0 74 26 e8 2a b3 23 fe <0f> 0b e8 23 b3 23 fe 48 89 ee 48 c7 c7 fa ff ff ff c6 44 24 58 01
RSP: 0018:ffffc90003f3f1a8 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff888077ff5550 RCX: 0000000000000000
RDX: ffff888079823a80 RSI: ffffffff835c6ad6 RDI: 0000000000000005
RBP: 0000000000000005 R08: 0000000000000005 R09: 0000000000000000
R10: 00000000fffffff4 R11: 0000000000000000 R12: ffff888070c82498
R13: 1ffff920007e7e39 R14: 0000000000000001 R15: ffff88807988c000
FS:  0000555556352300(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000563fb299cfd0 CR3: 0000000027d0e000 CR4: 0000000000350ee0
----------------
Code disassembly (best guess):
   0:	28 00                	sub    %al,(%rax)
   2:	00 00                	add    %al,(%rax)
   4:	75 05                	jne    0xb
   6:	48 83 c4 28          	add    $0x28,%rsp
   a:	c3                   	retq
   b:	e8 11 15 00 00       	callq  0x1521
  10:	90                   	nop
  11:	48 89 f8             	mov    %rdi,%rax
  14:	48 89 f7             	mov    %rsi,%rdi
  17:	48 89 d6             	mov    %rdx,%rsi
  1a:	48 89 ca             	mov    %rcx,%rdx
  1d:	4d 89 c2             	mov    %r8,%r10
  20:	4d 89 c8             	mov    %r9,%r8
  23:	4c 8b 4c 24 08       	mov    0x8(%rsp),%r9
  28:	0f 05                	syscall
* 2a:	48 3d 01 f0 ff ff    	cmp    $0xfffffffffffff001,%rax <-- trapping instruction
  30:	73 01                	jae    0x33
  32:	c3                   	retq
  33:	48 c7 c1 c0 ff ff ff 	mov    $0xffffffffffffffc0,%rcx
  3a:	f7 d8                	neg    %eax
  3c:	64 89 01             	mov    %eax,%fs:(%rcx)
  3f:	48                   	rex.W

Fix bisection attempts:
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-upstream-fs 2022/11/21 20:40 upstream eb7081409f94 10323ddf .config log report syz C
* Struck through repros no longer work on HEAD.
Crashes (11):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-root 2022/12/09 06:47 upstream ce19275f0103 1034e5fa .config log report syz C kernel BUG in btrfs_free_tree_block
ci2-upstream-fs 2022/12/02 21:45 upstream a4412fdd49dc e080de16 .config log report syz C kernel BUG in btrfs_free_tree_block
ci2-upstream-fs 2022/09/27 16:30 upstream 3800a713b607 10323ddf .config log report syz C kernel BUG in btrfs_free_tree_block
ci-upstream-gce-arm64 2022/09/26 05:11 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci c194837ebb57 0042f2b4 .config log report syz C kernel BUG in btrfs_free_tree_block
ci2-upstream-fs 2022/11/26 01:44 upstream 08ad43d554ba f4470a7b .config log report info kernel BUG in btrfs_free_tree_block
ci2-upstream-fs 2022/10/19 13:58 upstream 493ffd6605b2 b31320fc .config log report info kernel BUG in btrfs_free_tree_block
ci-upstream-linux-next-kasan-gce-root 2022/10/22 17:10 linux-next 4d48f589d294 c0b80a55 .config log report info kernel BUG in btrfs_free_tree_block
ci-upstream-gce-arm64 2022/12/08 02:15 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a5541c0811a0 d88f3abb .config log report info kernel BUG in btrfs_free_tree_block
ci-upstream-gce-arm64 2022/12/04 22:13 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci e3cb714fb489 e080de16 .config log report info kernel BUG in btrfs_free_tree_block
ci-upstream-gce-arm64 2022/12/01 03:09 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci cdb931b58ff5 4c2a66e8 .config log report info kernel BUG in btrfs_free_tree_block
ci-upstream-gce-arm64 2022/11/30 19:08 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci cdb931b58ff5 4c2a66e8 .config log report info kernel BUG in btrfs_free_tree_block
* Struck through repros no longer work on HEAD.