[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen stable-4.6] x86/hvm: Clobber %cs.L when LME becomes set
commit cadd37e106b2947e0d61f98c8e95cd3a04d5ac6d Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Tue Oct 25 17:17:45 2016 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Tue Oct 25 17:17:45 2016 +0200 x86/hvm: Clobber %cs.L when LME becomes set Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> master commit: ed00f1761689ac7b9c074e9084c81e47c25d460c master date: 2016-10-14 12:44:29 +0100 --- xen/arch/x86/hvm/hvm.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 7d10ab0..3c5faca 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -3203,6 +3203,30 @@ int hvm_set_efer(uint64_t value) return X86EMUL_EXCEPTION; } + if ( (value & EFER_LME) && !(v->arch.hvm_vcpu.guest_efer & EFER_LME) ) + { + struct segment_register cs; + + hvm_get_segment_register(v, x86_seg_cs, &cs); + + /* + * %cs may be loaded with both .D and .L set in legacy mode, and both + * are captured in the VMCS/VMCB. + * + * If a guest does this and then tries to transition into long mode, + * the vmentry from setting LME fails due to invalid guest state, + * because %cr0.PG is still clear. + * + * When LME becomes set, clobber %cs.L to keep the guest firmly in + * compatibility mode until it reloads %cs itself. + */ + if ( cs.attr.fields.l ) + { + cs.attr.fields.l = 0; + hvm_set_segment_register(v, x86_seg_cs, &cs); + } + } + if ( nestedhvm_enabled(v->domain) && cpu_has_svm && ((value & EFER_SVME) == 0 ) && ((value ^ v->arch.hvm_vcpu.guest_efer) & EFER_SVME) ) -- generated by git-patchbot for /home/xen/git/xen.git#stable-4.6 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |