WARNING in save_fpregs_to_fpstate

From: Wei Chen
Date: Sun Oct 30 2022 - 06:38:20 EST


Dear Linux Developer,

Recently when using our tool to fuzz kernel, the following crash was triggered:

HEAD commit: 64570fbc14f8 Linux 5.15-rc5
git tree: upstream
compiler: gcc 8.0.1
console output:
https://drive.google.com/file/d/1DkbPrIA6cVbIgS86sfFCZARE1jKhbMTk/view?usp=share_link
kernel config: https://drive.google.com/file/d/1uDOeEYgJDcLiSOrx9W8v2bqZ6uOA_55t/view?usp=share_link

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: Wei Chen <harperchen1110@xxxxxxxxx>

set kvm_intel.dump_invalid_vmcs=1 to dump internal KVM state.
------------[ cut here ]------------
WARNING: CPU: 1 PID: 11082 at arch/x86/include/asm/fpu/internal.h:304
save_fpregs_to_fpstate+0xc2/0xe0
Modules linked in:
CPU: 1 PID: 11082 Comm: syz-executor.0 Not tainted 5.15.0-rc5 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.13.0-48-gd9c812dda519-prebuilt.qemu.org 04/01/2014
RIP: 0010:save_fpregs_to_fpstate+0xc2/0xe0
Code: 08 5b 5d 41 5c 41 5d 41 5e e9 da c3 29 00 e8 d5 c3 29 00 48 0f
ae 45 40 5b 5d 41 5c 41 5d 41 5e e9 c3 c3 29 00 e8 be c3 29 00 <0f> 0b
eb a2 e8 b5 c3 29 00 0f 0b e9 75 ff ff ff 0f 1f 40 00 66 2e
RSP: 0018:ffffc900028ffda0 EFLAGS: 00010212
RAX: 000000000000e11d RBX: 00000000fffffffe RCX: 0000000000040000
RDX: ffffc90002a29000 RSI: ffff888135ae3700 RDI: 0000000000000002
RBP: ffff888010bde180 R08: ffffffff8113afa2 R09: 0000000000000000
R10: 0000000000000005 R11: 00000000fffffffe R12: 0000000000000007
R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001
FS: 00007ffa8d5d6700(0000) GS:ffff88813dc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 000000003d98d000 CR4: 00000000000026e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000006e52
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Call Trace:
kvm_save_current_fpu+0x61/0x70
kvm_put_guest_fpu+0x34/0x230
kvm_arch_vcpu_ioctl_run+0x541/0xb20
kvm_vcpu_ioctl+0x3b8/0xa30
__x64_sys_ioctl+0xe8/0x140
do_syscall_64+0x34/0xb0
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x4692c9
Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 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 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffa8d5d5c38 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00000000004692c9
RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 0000000000000005
RBP: 000000000119bfb0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000119bfac
R13: 0000000000000000 R14: 000000000119bfa0 R15: 00007fff96fd8ad0

Best,
Wei