* request for 4.14-stable: 5663d8f9bbe4 ("kvm: x86: fix WARN due to uninitialized guest FPU state")
@ 2018-10-23 9:38 Sudip Mukherjee
2018-10-23 13:45 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Sudip Mukherjee @ 2018-10-23 9:38 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: stable, Peter Xu, Paolo Bonzini
[-- Attachment #1: Type: text/plain, Size: 89 bytes --]
Hi Greg,
This was missing in 4.14-stable. Please apply to your queue.
--
Regards
Sudip
[-- Attachment #2: 0001-kvm-x86-fix-WARN-due-to-uninitialized-guest-FPU-stat.patch --]
[-- Type: text/x-diff, Size: 2318 bytes --]
>From a5b70129bafbfc2b144bde39d0cdb0a517be102e Mon Sep 17 00:00:00 2001
From: Peter Xu <peterx@redhat.com>
Date: Tue, 12 Dec 2017 17:15:02 +0100
Subject: [PATCH] kvm: x86: fix WARN due to uninitialized guest FPU state
commit 5663d8f9bbe4bf15488f7351efb61ea20fa6de06 upstream
------------[ cut here ]------------
Bad FPU state detected at kvm_put_guest_fpu+0xd8/0x2d0 [kvm], reinitializing FPU registers.
WARNING: CPU: 1 PID: 4594 at arch/x86/mm/extable.c:103 ex_handler_fprestore+0x88/0x90
CPU: 1 PID: 4594 Comm: qemu-system-x86 Tainted: G B OE 4.15.0-rc2+ #10
RIP: 0010:ex_handler_fprestore+0x88/0x90
Call Trace:
fixup_exception+0x4e/0x60
do_general_protection+0xff/0x270
general_protection+0x22/0x30
RIP: 0010:kvm_put_guest_fpu+0xd8/0x2d0 [kvm]
RSP: 0018:ffff8803d5627810 EFLAGS: 00010246
kvm_vcpu_reset+0x3b4/0x3c0 [kvm]
kvm_apic_accept_events+0x1c0/0x240 [kvm]
kvm_arch_vcpu_ioctl_run+0x1658/0x2fb0 [kvm]
kvm_vcpu_ioctl+0x479/0x880 [kvm]
do_vfs_ioctl+0x142/0x9a0
SyS_ioctl+0x74/0x80
do_syscall_64+0x15f/0x600
where kvm_put_guest_fpu is called without a prior kvm_load_guest_fpu.
To fix it, move kvm_load_guest_fpu to the very beginning of
kvm_arch_vcpu_ioctl_run.
Cc: stable@vger.kernel.org
Fixes: f775b13eedee2f7f3c6fdd4e90fb79090ce5d339
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
arch/x86/kvm/x86.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 3856828ee1dc..8d688b213504 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -7393,13 +7393,12 @@ static int complete_emulated_mmio(struct kvm_vcpu *vcpu)
int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
{
- struct fpu *fpu = ¤t->thread.fpu;
int r;
- fpu__initialize(fpu);
-
kvm_sigset_activate(vcpu);
+ kvm_load_guest_fpu(vcpu);
+
if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)) {
if (kvm_run->immediate_exit) {
r = -EINTR;
@@ -7440,6 +7439,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
r = vcpu_run(vcpu);
out:
+ kvm_put_guest_fpu(vcpu);
post_kvm_run_save(vcpu);
kvm_sigset_deactivate(vcpu);
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: request for 4.14-stable: 5663d8f9bbe4 ("kvm: x86: fix WARN due to uninitialized guest FPU state")
2018-10-23 9:38 request for 4.14-stable: 5663d8f9bbe4 ("kvm: x86: fix WARN due to uninitialized guest FPU state") Sudip Mukherjee
@ 2018-10-23 13:45 ` Paolo Bonzini
2018-10-31 14:34 ` Sasha Levin
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2018-10-23 13:45 UTC (permalink / raw)
To: Sudip Mukherjee, Greg Kroah-Hartman; +Cc: stable, Peter Xu
On 23/10/2018 11:38, Sudip Mukherjee wrote:
> Hi Greg,
>
> This was missing in 4.14-stable. Please apply to your queue.
>
> --
> Regards
> Sudip
>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: request for 4.14-stable: 5663d8f9bbe4 ("kvm: x86: fix WARN due to uninitialized guest FPU state")
2018-10-23 13:45 ` Paolo Bonzini
@ 2018-10-31 14:34 ` Sasha Levin
0 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2018-10-31 14:34 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: Sudip Mukherjee, Greg Kroah-Hartman, stable, Peter Xu
On Tue, Oct 23, 2018 at 03:45:44PM +0200, Paolo Bonzini wrote:
>On 23/10/2018 11:38, Sudip Mukherjee wrote:
>> Hi Greg,
>>
>> This was missing in 4.14-stable. Please apply to your queue.
>>
>> --
>> Regards
>> Sudip
>>
>
>Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Queued up for 4.14.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-31 23:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-23 9:38 request for 4.14-stable: 5663d8f9bbe4 ("kvm: x86: fix WARN due to uninitialized guest FPU state") Sudip Mukherjee
2018-10-23 13:45 ` Paolo Bonzini
2018-10-31 14:34 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox