syzbot


general protection fault in ovl_encode_real_fh

Status: fixed on 2023/12/21 03:45
Subsystems: overlayfs
[Documentation on labels]
Reported-by: syzbot+2208f82282740c1c8915@syzkaller.appspotmail.com
Fix commit: c7242a45cb8c ovl: fix NULL pointer defer when encoding non-decodable lower fid
First crash: 241d, last: 235d
Cause bisection: introduced by (bisect log) :
commit 16aac5ad1fa94894b798dd522c5c3a6a0628d7f0
Author: Amir Goldstein <amir73il@gmail.com>
Date: Sun Apr 23 16:02:04 2023 +0000

  ovl: support encoding non-decodable file handles

Crash: BUG: unable to handle kernel NULL pointer dereference in ovl_encode_real_fh (log)
Repro: C syz .config
  
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [overlayfs?] general protection fault in ovl_encode_real_fh 1 (4) 2023/10/03 08:06
Last patch testing requests (1)
Created Duration User Patch Repo Result
2023/10/03 07:45 18m amir73il@gmail.com git://git.kernel.org/pub/scm/linux/kernel/git/overlayfs/vfs.git ovl-fixes OK log

Sample crash report:
general protection fault, probably for non-canonical address 0xdffffc000000001c: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x00000000000000e0-0x00000000000000e7]
CPU: 1 PID: 5028 Comm: syz-executor194 Not tainted 6.6.0-rc4-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023
RIP: 0010:ovl_encode_real_fh+0x87/0x400 fs/overlayfs/copy_up.c:380
Code: 20 49 c1 ee 03 48 b8 f1 f1 f1 f1 04 f3 f3 f3 49 89 04 1e e8 1b e5 8b fe 48 89 d9 49 8d 9c 24 e0 00 00 00 48 89 d8 48 c1 e8 03 <80> 3c 08 00 74 12 48 89 df e8 0b 61 e6 fe 48 b9 00 00 00 00 00 fc
RSP: 0018:ffffc900039efc80 EFLAGS: 00010202
RAX: 000000000000001c RBX: 00000000000000e0 RCX: dffffc0000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff8880132ab500
RBP: ffffc900039efd30 R08: ffffffff8302916f R09: 1ffff1100ed51471
R10: dffffc0000000000 R11: ffffed100ed51472 R12: 0000000000000000
R13: ffff8880132ab500 R14: 1ffff9200073df94 R15: ffff888078f34758
FS:  0000555556705380(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020001000 CR3: 000000001bfb2000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 ovl_dentry_to_fid fs/overlayfs/export.c:240 [inline]
 ovl_encode_fh+0x2ac/0xc70 fs/overlayfs/export.c:275
 exportfs_encode_inode_fh fs/exportfs/expfs.c:407 [inline]
 exportfs_encode_fh+0x195/0x490 fs/exportfs/expfs.c:438
 do_sys_name_to_handle fs/fhandle.c:52 [inline]
 __do_sys_name_to_handle_at fs/fhandle.c:116 [inline]
 __se_sys_name_to_handle_at+0x3ad/0x730 fs/fhandle.c:98
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f37d63e4429
Code: 48 83 c4 28 c3 e8 37 17 00 00 0f 1f 80 00 00 00 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd5eea5b98 EFLAGS: 00000246 ORIG_RAX: 000000000000012f
RAX: ffffffffffffffda RBX: 00007ffd5eea5d68 RCX: 00007f37d63e4429
RDX: 0000000020000300 RSI: 0000000020000240 RDI: 0000000000000003
RBP: 00007f37d6457610 R08: 0000000000001600 R09: 00007ffd5eea5d68
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffd5eea5d58 R14: 0000000000000001 R15: 0000000000000001
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:ovl_encode_real_fh+0x87/0x400 fs/overlayfs/copy_up.c:380
Code: 20 49 c1 ee 03 48 b8 f1 f1 f1 f1 04 f3 f3 f3 49 89 04 1e e8 1b e5 8b fe 48 89 d9 49 8d 9c 24 e0 00 00 00 48 89 d8 48 c1 e8 03 <80> 3c 08 00 74 12 48 89 df e8 0b 61 e6 fe 48 b9 00 00 00 00 00 fc
RSP: 0018:ffffc900039efc80 EFLAGS: 00010202
RAX: 000000000000001c RBX: 00000000000000e0 RCX: dffffc0000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff8880132ab500
RBP: ffffc900039efd30 R08: ffffffff8302916f R09: 1ffff1100ed51471
R10: dffffc0000000000 R11: ffffed100ed51472 R12: 0000000000000000
R13: ffff8880132ab500 R14: 1ffff9200073df94 R15: ffff888078f34758
FS:  0000555556705380(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020001000 CR3: 000000001bfb2000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	20 49 c1             	and    %cl,-0x3f(%rcx)
   3:	ee                   	out    %al,(%dx)
   4:	03 48 b8             	add    -0x48(%rax),%ecx
   7:	f1                   	int1
   8:	f1                   	int1
   9:	f1                   	int1
   a:	f1                   	int1
   b:	04 f3                	add    $0xf3,%al
   d:	f3 f3 49 89 04 1e    	repz xrelease mov %rax,(%r14,%rbx,1)
  13:	e8 1b e5 8b fe       	call   0xfe8be533
  18:	48 89 d9             	mov    %rbx,%rcx
  1b:	49 8d 9c 24 e0 00 00 	lea    0xe0(%r12),%rbx
  22:	00
  23:	48 89 d8             	mov    %rbx,%rax
  26:	48 c1 e8 03          	shr    $0x3,%rax
* 2a:	80 3c 08 00          	cmpb   $0x0,(%rax,%rcx,1) <-- trapping instruction
  2e:	74 12                	je     0x42
  30:	48 89 df             	mov    %rbx,%rdi
  33:	e8 0b 61 e6 fe       	call   0xfee66143
  38:	48                   	rex.W
  39:	b9 00 00 00 00       	mov    $0x0,%ecx
  3e:	00 fc                	add    %bh,%ah

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/10/02 23:37 upstream 8a749fd1a872 50b20e75 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci2-upstream-fs general protection fault in ovl_encode_real_fh
2023/10/02 23:07 upstream 8a749fd1a872 50b20e75 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs general protection fault in ovl_encode_real_fh
2023/09/27 05:43 upstream 50768a425b46 0b6a67ac .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs general protection fault in ovl_encode_real_fh
* Struck through repros no longer work on HEAD.