syzbot


general protection fault in erofs_bread

Status: upstream: reported C repro on 2022/10/21 04:45
Reported-by: syzbot+3faecbfd845a895c04cb@syzkaller.appspotmail.com
Fix commit: e5126de138ca erofs: fix general protection fault when reading fragment
Patched on: [ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-arm64 ci-upstream-gce-leak 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 ci-upstream-kmsan-gce-386 ci-upstream-linux-next-kasan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-usb], missing on: [ci-qemu2-riscv64]
First crash: 100d, last: 91d

Cause bisection: failed (bisect log)

Sample crash report:
loop0: detected capacity change from 0 to 264192
erofs: (device loop0): mounted with root inode @ nid 36.
general protection fault, probably for non-canonical address 0xdffffc0000000006: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000030-0x0000000000000037]
CPU: 1 PID: 3601 Comm: syz-executor665 Not tainted 6.1.0-rc2-syzkaller-00105-gb229b6ca5abb #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/11/2022
RIP: 0010:erofs_bread+0x34/0x6f0 fs/erofs/data.c:35
Code: 54 49 89 f4 55 89 d5 53 48 89 fb 48 83 ec 08 e8 02 2f c4 fd 49 8d 7c 24 30 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 36 06 00 00 48 89 da 4d 8b 64 24 30 48 b8 00 00
RSP: 0018:ffffc90003e8f608 EFLAGS: 00010216
RAX: dffffc0000000000 RBX: ffffc90003e8f750 RCX: 0000000000000000
RDX: 0000000000000006 RSI: ffffffff83b86d7e RDI: 0000000000000030
RBP: 000000007ec94954 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000a62 R11: 0000000000000000 R12: 0000000000000000
R13: 032487ec94954840 R14: 0000000000000001 R15: dffffc0000000000
FS:  00005555574a5300(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f2ea2b7b260 CR3: 00000000203d8000 CR4: 0000000000350ee0
Call Trace:
 <TASK>
 z_erofs_read_fragment fs/erofs/zdata.c:667 [inline]
 z_erofs_do_read_page+0x593/0x3bb0 fs/erofs/zdata.c:780
 z_erofs_pcluster_readmore+0x378/0x830 fs/erofs/zdata.c:1589
 z_erofs_read_folio+0x248/0x6e0 fs/erofs/zdata.c:1616
 filemap_read_folio+0xdb/0x2c0 mm/filemap.c:2407
 do_read_cache_folio+0x1df/0x510 mm/filemap.c:3534
 erofs_bread+0x150/0x6f0 fs/erofs/data.c:46
 find_target_block_classic fs/erofs/namei.c:108 [inline]
 erofs_namei+0x1f9/0xc40 fs/erofs/namei.c:184
 erofs_lookup fs/erofs/namei.c:212 [inline]
 erofs_lookup+0x312/0x4f0 fs/erofs/namei.c:199
 __lookup_hash+0x117/0x180 fs/namei.c:1601
 filename_create+0x1d6/0x4a0 fs/namei.c:3807
 do_mkdirat+0x99/0x310 fs/namei.c:4050
 __do_sys_mkdirat fs/namei.c:4075 [inline]
 __se_sys_mkdirat fs/namei.c:4073 [inline]
 __x64_sys_mkdirat+0x115/0x170 fs/namei.c:4073
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f15a0dc6039
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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:00007ffc02ea30e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000102
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f15a0dc6039
RDX: 0000000000000000 RSI: 00000000200002c0 RDI: 0000000000000005
RBP: 00007f15a0d85830 R08: 00005555574a52c0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f15a0d858c0
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:erofs_bread+0x34/0x6f0 fs/erofs/data.c:35
Code: 54 49 89 f4 55 89 d5 53 48 89 fb 48 83 ec 08 e8 02 2f c4 fd 49 8d 7c 24 30 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 36 06 00 00 48 89 da 4d 8b 64 24 30 48 b8 00 00
RSP: 0018:ffffc90003e8f608 EFLAGS: 00010216
RAX: dffffc0000000000 RBX: ffffc90003e8f750 RCX: 0000000000000000
RDX: 0000000000000006 RSI: ffffffff83b86d7e RDI: 0000000000000030
RBP: 000000007ec94954 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000a62 R11: 0000000000000000 R12: 0000000000000000
R13: 032487ec94954840 R14: 0000000000000001 R15: dffffc0000000000
FS:  00005555574a5300(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f2ea2b7b260 CR3: 00000000203d8000 CR4: 0000000000350ee0
----------------
Code disassembly (best guess):
   0:	54                   	push   %rsp
   1:	49 89 f4             	mov    %rsi,%r12
   4:	55                   	push   %rbp
   5:	89 d5                	mov    %edx,%ebp
   7:	53                   	push   %rbx
   8:	48 89 fb             	mov    %rdi,%rbx
   b:	48 83 ec 08          	sub    $0x8,%rsp
   f:	e8 02 2f c4 fd       	callq  0xfdc42f16
  14:	49 8d 7c 24 30       	lea    0x30(%r12),%rdi
  19:	48 b8 00 00 00 00 00 	movabs $0xdffffc0000000000,%rax
  20:	fc ff df
  23:	48 89 fa             	mov    %rdi,%rdx
  26:	48 c1 ea 03          	shr    $0x3,%rdx
* 2a:	80 3c 02 00          	cmpb   $0x0,(%rdx,%rax,1) <-- trapping instruction
  2e:	0f 85 36 06 00 00    	jne    0x66a
  34:	48 89 da             	mov    %rbx,%rdx
  37:	4d 8b 64 24 30       	mov    0x30(%r12),%r12
  3c:	48                   	rex.W
  3d:	b8                   	.byte 0xb8

Crashes (3):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce-root 2022/10/30 19:47 upstream b229b6ca5abb 2a71366b .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] general protection fault in erofs_bread
ci2-upstream-fs 2022/10/21 04:01 upstream 493ffd6605b2 a0fd4dab .config strace log report syz C [disk image] [vmlinux] [mounted in repro] general protection fault in erofs_bread
ci2-upstream-fs 2022/10/21 03:51 upstream 493ffd6605b2 a0fd4dab .config console log report info [disk image] [vmlinux] general protection fault in erofs_bread
* Struck through repros no longer work on HEAD.