From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Zhang Haoyu <haoyu.zhang@huawei.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [ 03/17] KVM: x86: remove vcpus CPL check in host-invoked XCR set
Date: Tue, 25 Jun 2013 11:39:18 -0700 [thread overview]
Message-ID: <20130625183915.835902978@linuxfoundation.org> (raw)
In-Reply-To: <20130625183915.443950649@linuxfoundation.org>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Zhanghaoyu (A)" <haoyu.zhang@huawei.com>
commit 764bcbc5a6d7a2f3e75c9f0e4caa984e2926e346 upstream.
__kvm_set_xcr function does the CPL check when set xcr. __kvm_set_xcr is
called in two flows, one is invoked by guest, call stack shown as below,
handle_xsetbv(or xsetbv_interception)
kvm_set_xcr
__kvm_set_xcr
the other one is invoked by host, for example during system reset:
kvm_arch_vcpu_ioctl
kvm_vcpu_ioctl_x86_set_xcrs
__kvm_set_xcr
The former does need the CPL check, but the latter does not.
Signed-off-by: Zhang Haoyu <haoyu.zhang@huawei.com>
[Tweaks to commit message. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/x86/kvm/x86.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -548,8 +548,6 @@ int __kvm_set_xcr(struct kvm_vcpu *vcpu,
if (index != XCR_XFEATURE_ENABLED_MASK)
return 1;
xcr0 = xcr;
- if (kvm_x86_ops->get_cpl(vcpu) != 0)
- return 1;
if (!(xcr0 & XSTATE_FP))
return 1;
if ((xcr0 & XSTATE_YMM) && !(xcr0 & XSTATE_SSE))
@@ -563,7 +561,8 @@ int __kvm_set_xcr(struct kvm_vcpu *vcpu,
int kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
{
- if (__kvm_set_xcr(vcpu, index, xcr)) {
+ if (kvm_x86_ops->get_cpl(vcpu) != 0 ||
+ __kvm_set_xcr(vcpu, index, xcr)) {
kvm_inject_gp(vcpu, 0);
return 1;
}
next prev parent reply other threads:[~2013-06-25 18:39 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-25 18:39 [ 00/17] 3.0.84-stable review Greg Kroah-Hartman
2013-06-25 18:39 ` [ 01/17] ALSA: usb-audio: work around Android accessory firmware bug Greg Kroah-Hartman
2013-06-25 18:39 ` [ 02/17] tilepro: work around module link error with gcc 4.7 Greg Kroah-Hartman
2013-06-25 18:39 ` Greg Kroah-Hartman [this message]
2013-06-25 18:39 ` [ 04/17] tcp: fix tcp_md5_hash_skb_data() Greg Kroah-Hartman
2013-06-25 18:39 ` [ 05/17] gianfar: add missing iounmap() on error in gianfar_ptp_probe() Greg Kroah-Hartman
2013-06-25 18:39 ` [ 06/17] ipv6: fix possible crashes in ip6_cork_release() Greg Kroah-Hartman
2013-06-25 18:39 ` [ 07/17] netlabel: improve domain mapping validation Greg Kroah-Hartman
2013-06-25 18:39 ` [ 08/17] tcp: xps: fix reordering issues Greg Kroah-Hartman
2013-06-25 18:39 ` [ 09/17] ip_tunnel: fix kernel panic with icmp_dest_unreach Greg Kroah-Hartman
2013-06-25 18:39 ` [ 10/17] net: Block MSG_CMSG_COMPAT in send(m)msg and recv(m)msg Greg Kroah-Hartman
2013-06-25 18:39 ` [ 11/17] net: force a reload of first item in hlist_nulls_for_each_entry_rcu Greg Kroah-Hartman
2013-06-25 18:39 ` [ 12/17] ipv6: assign rt6_info to inet6_ifaddr in init_loopback Greg Kroah-Hartman
2013-06-25 18:39 ` [ 13/17] net: sctp: fix NULL pointer dereference in socket destruction Greg Kroah-Hartman
2013-06-25 18:39 ` [ 14/17] packet: packet_getname_spkt: make sure string is always 0-terminated Greg Kroah-Hartman
2013-06-25 18:39 ` [ 15/17] l2tp: Fix PPP header erasure and memory leak Greg Kroah-Hartman
2013-06-25 18:39 ` [ 16/17] l2tp: Fix sendmsg() return value Greg Kroah-Hartman
2013-06-25 18:39 ` [ 17/17] USB: serial: ti_usb_3410_5052: new device id for Abbot strip port cable Greg Kroah-Hartman
2013-06-25 21:39 ` Anders Hammarquist
2013-06-26 17:21 ` Greg Kroah-Hartman
2013-06-27 0:28 ` Anders Hammarquist
2013-06-25 19:23 ` [ 00/17] 3.0.84-stable review Guenter Roeck
2013-06-25 19:32 ` Geert Uytterhoeven
2013-06-25 19:39 ` Guenter Roeck
2013-06-26 7:34 ` Geert Uytterhoeven
2013-06-26 14:40 ` Guenter Roeck
2013-06-26 23:06 ` Greg Ungerer
2013-06-26 23:29 ` Guenter Roeck
2013-08-01 14:35 ` Greg Ungerer
2013-08-01 15:08 ` Guenter Roeck
2013-06-26 4:16 ` Greg Kroah-Hartman
2013-06-26 16:57 ` Shuah Khan
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=20130625183915.835902978@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=haoyu.zhang@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=stable@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox