kvm: WARNING in kvm_load_guest_fpu

From: Dmitry Vyukov
Date: Fri Nov 11 2016 - 22:58:00 EST


Hello,

The following program triggers WARNING in kvm_load_guest_fpu:
https://gist.githubusercontent.com/dvyukov/5bc076073b48772e22b5f33acbe2b743/raw/1000df869f0d58a5c6e637268453c711280b255d/gistfile1.txt

On commit 015ed9433be2b476ec7e2e6a9a411a56e3b5b035 (Nov 11).

WARNING: CPU: 3 PID: 23924 at
./arch/x86/include/asm/fpu/internal.h:164
kvm_load_guest_fpu.part.163+0xf1/0x340
Kernel panic - not syncing: panic_on_warn set ...

CPU: 3 PID: 23924 Comm: syz-executor Not tainted 4.9.0-rc4+ #44
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
ffff88006ce67920 ffffffff81c2f79b ffffffff83271fc0 ffff88006ce679f8
ffffffff8321c300 ffffffff81096631 ffff88006ce679e8 ffffffff81548463
0000000041b58ab3 ffffffff837cd505 ffffffff815482ac ffffffff815490e9
Call Trace:
[< inline >] __dump_stack lib/dump_stack.c:15
[<ffffffff81c2f79b>] dump_stack+0xb3/0x118 lib/dump_stack.c:51
[<ffffffff81548463>] panic+0x1b7/0x3a3 kernel/panic.c:179
[<ffffffff81240014>] __warn+0x1c4/0x1e0 kernel/panic.c:542
[<ffffffff812401fc>] warn_slowpath_null+0x2c/0x40 kernel/panic.c:585
[< inline >] copy_kernel_to_fxregs
arch/x86/include/asm/fpu/internal.h:164
[< inline >] __copy_kernel_to_fpregs
arch/x86/include/asm/fpu/internal.h:454
[<ffffffff81096631>] kvm_load_guest_fpu.part.163+0xf1/0x340
arch/x86/kvm/x86.c:7383
[< inline >] kvm_load_guest_fpu arch/x86/kvm/x86.c:6456
[< inline >] vcpu_enter_guest arch/x86/kvm/x86.c:6660
[< inline >] vcpu_run arch/x86/kvm/x86.c:6826
[<ffffffff810bb493>] kvm_arch_vcpu_ioctl_run+0x3b13/0x5a90
arch/x86/kvm/x86.c:6984
[<ffffffff8106091e>] kvm_vcpu_ioctl+0x61e/0xdd0
arch/x86/kvm/../../../virt/kvm/kvm_main.c:2557
[< inline >] vfs_ioctl fs/ioctl.c:43
[<ffffffff816b16fc>] do_vfs_ioctl+0x18c/0x1040 fs/ioctl.c:679
[< inline >] SYSC_ioctl fs/ioctl.c:694
[<ffffffff816b263f>] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:685
[<ffffffff831ebdc1>] entry_SYSCALL_64_fastpath+0x1f/0xc2
Dumping ftrace buffer:
(ftrace buffer empty)
Kernel Offset: disabled
reboot: cpu_has_vmx: ecx=80a02021 1