Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1357018

Re: [PATCH 0/1] KVM: x86: using the fpu in interrupt context with a guest's xcr0

From Xiao Guangrong <guangrong.xiao@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH 0/1] KVM: x86: using the fpu in interrupt context with a guest's xcr0
Date 2016-03-14 08:50 +0100
Message-ID <rcvqi-KB-21@gated-at.bofh.it> (permalink)
References <rbCat-3jh-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 03/12/2016 04:47 AM, David Matlack wrote:

> I have not been able to trigger this bug on Linux 4.3, and suspect
> it is due to this commit from Linux 4.2:
>
> 653f52c kvm,x86: load guest FPU context more eagerly
>
> With this commit, as long as the host is using eagerfpu, the guest's
> fpu is always loaded just before the guest's xcr0 (vcpu->fpu_active
> is always 1 in the following snippet):
>
> 6569         if (vcpu->fpu_active)
> 6570                 kvm_load_guest_fpu(vcpu);
> 6571         kvm_load_guest_xcr0(vcpu);
>
> When the guest's fpu is loaded, irq_fpu_usable() returns false.

Er, i did not see that commit introduced this change.

>
> We've included our workaround for this bug, which applies to Linux 3.11.
> It does not apply cleanly to HEAD since the fpu subsystem was refactored
> in Linux 4.2. While the latest kernel does not look vulnerable, we may
> want to apply a fix to the vulnerable stable kernels.

Is the latest kvm safe if we use !eager fpu? Under this case, kvm_load_guest_fpu()
is not called for every single VM-enter, that means kernel will use guest's xcr0 to
save/restore XSAVE area.

Maybe a simpler fix is just calling __kernel_fpu_begin() when the CPU switches
to vCPU and reverts it when the vCPU is scheduled out or returns to userspace.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/1] KVM: x86: using the fpu in interrupt context with a guest's xcr0 David Matlack <dmatlack@google.com> - 2016-03-11 21:50 +0100
  [PATCH 1/1] KVM: don't allow irq_fpu_usable when the VCPU's XCR0 is loaded David Matlack <dmatlack@google.com> - 2016-03-11 21:50 +0100
    Re: [PATCH 1/1] KVM: don't allow irq_fpu_usable when the VCPU's XCR0  is loaded Andy Lutomirski <luto@amacapital.net> - 2016-03-11 22:20 +0100
      Re: [PATCH 1/1] KVM: don't allow irq_fpu_usable when the VCPU's XCR0  is loaded David Matlack <dmatlack@google.com> - 2016-03-11 22:40 +0100
        Re: [PATCH 1/1] KVM: don't allow irq_fpu_usable when the VCPU's XCR0  is loaded Paolo Bonzini <pbonzini@redhat.com> - 2016-03-14 14:20 +0100
          Re: [PATCH 1/1] KVM: don't allow irq_fpu_usable when the VCPU's XCR0  is loaded Andy Lutomirski <luto@amacapital.net> - 2016-03-15 19:30 +0100
            Re: [PATCH 1/1] KVM: don't allow irq_fpu_usable when the VCPU's XCR0  is loaded Paolo Bonzini <pbonzini@redhat.com> - 2016-03-15 20:40 +0100
              Re: [PATCH 1/1] KVM: don't allow irq_fpu_usable when the VCPU's XCR0  is loaded Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2016-03-16 05:00 +0100
                Re: [PATCH 1/1] KVM: don't allow irq_fpu_usable when the VCPU's XCR0  is loaded Paolo Bonzini <pbonzini@redhat.com> - 2016-03-16 13:10 +0100
  Re: [PATCH 0/1] KVM: x86: using the fpu in interrupt context with a  guest's xcr0 Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2016-03-14 08:50 +0100
    Re: [PATCH 0/1] KVM: x86: using the fpu in interrupt context with a  guest's xcr0 David Matlack <dmatlack@google.com> - 2016-03-15 20:10 +0100
      Re: [PATCH 0/1] KVM: x86: using the fpu in interrupt context with a  guest's xcr0 Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2016-03-16 04:50 +0100
        Re: [PATCH 0/1] KVM: x86: using the fpu in interrupt context with a  guest's xcr0 Andy Lutomirski <luto@amacapital.net> - 2016-03-16 04:50 +0100
          Re: [PATCH 0/1] KVM: x86: using the fpu in interrupt context with a  guest's xcr0 David Matlack <dmatlack@google.com> - 2016-03-16 18:20 +0100
        Re: [PATCH 0/1] KVM: x86: using the fpu in interrupt context with a  guest's xcr0 David Matlack <dmatlack@google.com> - 2016-03-16 18:10 +0100

csiph-web