All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: kvm@vger.kernel.org, stable@vger.kernel.org,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Peter Xu" <peterx@redhat.com>, "Rik van Riel" <riel@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Thomas Lindroth" <thomas.lindroth@gmail.com>
Subject: Re: [PATCH] KVM: x86: Fix a 4.14 backport regression related to userspace/guest FPU
Date: Mon, 28 Jan 2019 17:14:34 -0500	[thread overview]
Message-ID: <20190128221434.GP3973@sasha-vm> (raw)
In-Reply-To: <20190128205102.29393-1-sean.j.christopherson@intel.com>

On Mon, Jan 28, 2019 at 12:51:02PM -0800, Sean Christopherson wrote:
>Upstream commit:
>
>    f775b13eedee ("x86,kvm: move qemu/guest FPU switching out to vcpu_run")
>
>introduced a bug, which was later fixed by upstream commit:
>
>    5663d8f9bbe4 ("kvm: x86: fix WARN due to uninitialized guest FPU state")
>
>For reasons unknown, both commits were initially passed-over for
>inclusion in the 4.14 stable branch despite being tagged for stable.
>Eventually, someone noticed that the fixup, commit 5663d8f9bbe4, was
>missing from stable[1], and so it was queued up for 4.14 and included in
>release v4.14.79.
>
>Even later, the original buggy patch, commit f775b13eedee, was also
>applied to the 4.14 stable branch.  Through an unlucky coincidence, the
>incorrect ordering did not generate a conflict between the two patches,
>and led to v4.14.94 and later releases containing a spurious call to
>kvm_load_guest_fpu() in kvm_arch_vcpu_ioctl_run().  As a result, KVM may
>reload stale guest FPU state, e.g. after accepting in INIT event.  This
>can manifest as crashes during boot, segfaults, failed checksums and so
>on and so forth.
>
>Remove the unwanted kvm_{load,put}_guest_fpu() calls, i.e. make
>kvm_arch_vcpu_ioctl_run() look like commit 5663d8f9bbe4 was backported
>after commit f775b13eedee.
>
>[1] https://www.spinics.net/lists/stable/msg263931.html
>
>Fixes: 4124a4cff344 ("x86,kvm: move qemu/guest FPU switching out to vcpu_run")
>Cc: stable@vger.kernel.org
>Cc: Sasha Levin <sashal@kernel.org>
>Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>Cc: Peter Xu <peterx@redhat.com>
>Cc: Rik van Riel <riel@redhat.com>
>Cc: Paolo Bonzini <pbonzini@redhat.com>
>Cc: Radim Krčmář <rkrcmar@redhat.com>
>Reported-by: Roman Mamedov
>Reported-by: Thomas Lindroth <thomas.lindroth@gmail.com>
>Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>

I agree with your analysis and the patch makes sense. Hopefully one of
the KVM folks can Ack.

WARNING: multiple messages have this Message-ID (diff)
From: Sasha Levin <sashal@kernel.org>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: kvm@vger.kernel.org, stable@vger.kernel.org,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Peter Xu" <peterx@redhat.com>, "Rik van Riel" <riel@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Thomas Lindroth" <thomas.lindroth@gmail.com>
Subject: Re: [PATCH] KVM: x86: Fix a 4.14 backport regression related to userspace/guest FPU
Date: Mon, 28 Jan 2019 17:14:34 -0500	[thread overview]
Message-ID: <20190128221434.GP3973@sasha-vm> (raw)
In-Reply-To: <20190128205102.29393-1-sean.j.christopherson@intel.com>

On Mon, Jan 28, 2019 at 12:51:02PM -0800, Sean Christopherson wrote:
>Upstream commit:
>
>    f775b13eedee ("x86,kvm: move qemu/guest FPU switching out to vcpu_run")
>
>introduced a bug, which was later fixed by upstream commit:
>
>    5663d8f9bbe4 ("kvm: x86: fix WARN due to uninitialized guest FPU state")
>
>For reasons unknown, both commits were initially passed-over for
>inclusion in the 4.14 stable branch despite being tagged for stable.
>Eventually, someone noticed that the fixup, commit 5663d8f9bbe4, was
>missing from stable[1], and so it was queued up for 4.14 and included in
>release v4.14.79.
>
>Even later, the original buggy patch, commit f775b13eedee, was also
>applied to the 4.14 stable branch.  Through an unlucky coincidence, the
>incorrect ordering did not generate a conflict between the two patches,
>and led to v4.14.94 and later releases containing a spurious call to
>kvm_load_guest_fpu() in kvm_arch_vcpu_ioctl_run().  As a result, KVM may
>reload stale guest FPU state, e.g. after accepting in INIT event.  This
>can manifest as crashes during boot, segfaults, failed checksums and so
>on and so forth.
>
>Remove the unwanted kvm_{load,put}_guest_fpu() calls, i.e. make
>kvm_arch_vcpu_ioctl_run() look like commit 5663d8f9bbe4 was backported
>after commit f775b13eedee.
>
>[1] https://www.spinics.net/lists/stable/msg263931.html
>
>Fixes: 4124a4cff344 ("x86,kvm: move qemu/guest FPU switching out to vcpu_run")
>Cc: stable@vger.kernel.org
>Cc: Sasha Levin <sashal@kernel.org>
>Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>Cc: Peter Xu <peterx@redhat.com>
>Cc: Rik van Riel <riel@redhat.com>
>Cc: Paolo Bonzini <pbonzini@redhat.com>
>Cc: Radim Krčmář <rkrcmar@redhat.com>
>Reported-by: Roman Mamedov
>Reported-by: Thomas Lindroth <thomas.lindroth@gmail.com>
>Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>

I agree with your analysis and the patch makes sense. Hopefully one of
the KVM folks can Ack.

--
Thanks,
Sasha

  reply	other threads:[~2019-01-28 22:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-28 20:51 [PATCH] KVM: x86: Fix a 4.14 backport regression related to userspace/guest FPU Sean Christopherson
2019-01-28 22:14 ` Sasha Levin [this message]
2019-01-28 22:14   ` Sasha Levin
2019-01-29  8:50   ` Paolo Bonzini
2019-01-29  9:42 ` Greg Kroah-Hartman
2019-01-29 10:32 ` Thomas Lindroth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190128221434.GP3973@sasha-vm \
    --to=sashal@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=riel@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=thomas.lindroth@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.