syzbot


general protection fault in z_erofs_gbuf_growsize

Status: fixed on 2024/10/03 15:25
Subsystems: erofs
[Documentation on labels]
Reported-by: syzbot+242ee56aaa9585553766@syzkaller.appspotmail.com
Fix commit: 0005e01e1e87 erofs: fix out-of-bound access when z_erofs_gbuf_growsize() partially fails
First crash: 61d, last: 61d
Discussions (2)
Title Replies (including bot) Last reply
[PATCH RESEND] erofs: fix out-of-bound access when z_erofs_gbuf_growsize() partially fails 2 (2) 2024/08/20 18:14
[syzbot] [erofs?] general protection fault in z_erofs_gbuf_growsize 0 (1) 2024/08/20 07:57

Sample crash report:
loop0: detected capacity change from 0 to 16
FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 0, space 0, times 1
CPU: 0 UID: 0 PID: 5102 Comm: syz.0.0 Not tainted 6.11.0-rc3-syzkaller-00066-g1fb918967b56 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:93 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
 fail_dump lib/fault-inject.c:52 [inline]
 should_fail_ex+0x3b0/0x4e0 lib/fault-inject.c:153
 should_failslab+0xac/0x100 mm/failslab.c:45
 slab_pre_alloc_hook mm/slub.c:3941 [inline]
 slab_alloc_node mm/slub.c:4017 [inline]
 kmem_cache_alloc_node_noprof+0x71/0x320 mm/slub.c:4080
 alloc_vmap_area+0x24f/0x2400 mm/vmalloc.c:1986
 __get_vm_area_node+0x1a9/0x270 mm/vmalloc.c:3119
 get_vm_area_caller mm/vmalloc.c:3170 [inline]
 vmap+0x119/0x2b0 mm/vmalloc.c:3439
 z_erofs_gbuf_growsize+0x262/0x520 fs/erofs/zutil.c:96
 z_erofs_load_lz4_config fs/erofs/decompressor.c:58 [inline]
 z_erofs_parse_cfgs+0x1e6/0x680 fs/erofs/decompressor.c:494
 erofs_read_superblock fs/erofs/super.c:357 [inline]
 erofs_fc_fill_super+0x1194/0x1730 fs/erofs/super.c:628
 get_tree_bdev+0x3f7/0x570 fs/super.c:1635
 vfs_get_tree+0x90/0x2a0 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:0x7fe726b7b0ba
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 7e 1a 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe727918e68 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fe727918ef0 RCX: 00007fe726b7b0ba
RDX: 0000000020000180 RSI: 00000000200001c0 RDI: 00007fe727918eb0
RBP: 0000000020000180 R08: 00007fe727918ef0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 00000000200001c0
R13: 00007fe727918eb0 R14: 0000000000000174 R15: 0000000020000240
 </TASK>
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: 5102 Comm: syz.0.0 Not tainted 6.11.0-rc3-syzkaller-00066-g1fb918967b56 #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:z_erofs_gbuf_growsize+0x45f/0x520 fs/erofs/zutil.c:114
Code: 57 dc 9e fd 48 8b 1b 48 85 db 74 44 43 80 3c 26 00 74 08 4c 89 ef e8 40 dc 9e fd 48 c1 e5 03 49 03 6d 00 48 89 e8 48 c1 e8 03 <42> 80 3c 20 00 74 08 48 89 ef e8 22 dc 9e fd 48 3b 5d 00 74 18 e8
RSP: 0018:ffffc90002e4f918 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffffea000117ce40 RCX: ffff888020388000
RDX: ffff888020388000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffffffff845bf21b R09: 1ffffffff26e5f27
R10: dffffc0000000000 R11: fffffbfff26e5f28 R12: dffffc0000000000
R13: ffff88803267dcc8 R14: 1ffff110064cfb99 R15: 0000000000000000
FS:  00007fe7279196c0(0000) GS:ffff888020800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fc5da995ed8 CR3: 00000000369c6000 CR4: 0000000000350ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 z_erofs_load_lz4_config fs/erofs/decompressor.c:58 [inline]
 z_erofs_parse_cfgs+0x1e6/0x680 fs/erofs/decompressor.c:494
 erofs_read_superblock fs/erofs/super.c:357 [inline]
 erofs_fc_fill_super+0x1194/0x1730 fs/erofs/super.c:628
 get_tree_bdev+0x3f7/0x570 fs/super.c:1635
 vfs_get_tree+0x90/0x2a0 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:0x7fe726b7b0ba
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 7e 1a 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe727918e68 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fe727918ef0 RCX: 00007fe726b7b0ba
RDX: 0000000020000180 RSI: 00000000200001c0 RDI: 00007fe727918eb0
RBP: 0000000020000180 R08: 00007fe727918ef0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 00000000200001c0
R13: 00007fe727918eb0 R14: 0000000000000174 R15: 0000000020000240
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:z_erofs_gbuf_growsize+0x45f/0x520 fs/erofs/zutil.c:114
Code: 57 dc 9e fd 48 8b 1b 48 85 db 74 44 43 80 3c 26 00 74 08 4c 89 ef e8 40 dc 9e fd 48 c1 e5 03 49 03 6d 00 48 89 e8 48 c1 e8 03 <42> 80 3c 20 00 74 08 48 89 ef e8 22 dc 9e fd 48 3b 5d 00 74 18 e8
RSP: 0018:ffffc90002e4f918 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffffea000117ce40 RCX: ffff888020388000
RDX: ffff888020388000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffffffff845bf21b R09: 1ffffffff26e5f27
R10: dffffc0000000000 R11: fffffbfff26e5f28 R12: dffffc0000000000
R13: ffff88803267dcc8 R14: 1ffff110064cfb99 R15: 0000000000000000
FS:  00007fe7279196c0(0000) GS:ffff888020800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fc5da995ed8 CR3: 00000000369c6000 CR4: 0000000000350ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	57                   	push   %rdi
   1:	dc 9e fd 48 8b 1b    	fcompl 0x1b8b48fd(%rsi)
   7:	48 85 db             	test   %rbx,%rbx
   a:	74 44                	je     0x50
   c:	43 80 3c 26 00       	cmpb   $0x0,(%r14,%r12,1)
  11:	74 08                	je     0x1b
  13:	4c 89 ef             	mov    %r13,%rdi
  16:	e8 40 dc 9e fd       	call   0xfd9edc5b
  1b:	48 c1 e5 03          	shl    $0x3,%rbp
  1f:	49 03 6d 00          	add    0x0(%r13),%rbp
  23:	48 89 e8             	mov    %rbp,%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:	48 89 ef             	mov    %rbp,%rdi
  34:	e8 22 dc 9e fd       	call   0xfd9edc5b
  39:	48 3b 5d 00          	cmp    0x0(%rbp),%rbx
  3d:	74 18                	je     0x57
  3f:	e8                   	.byte 0xe8

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/08/15 15:08 upstream 1fb918967b56 e4bacdaf .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root general protection fault in z_erofs_gbuf_growsize
* Struck through repros no longer work on HEAD.