[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/HVM: XSETBV intercept needs to check CPL on SVM only
commit e513d8f7bc3db90e66bd2ed963b3142f412b770d Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Wed Dec 2 15:21:15 2015 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Wed Dec 2 15:21:15 2015 +0100 x86/HVM: XSETBV intercept needs to check CPL on SVM only VMX doesn't need a software CPL check on the XSETBV intercept, and SVM can do that check without resorting to hvm_get_segment_register(). Clean up what is left of hvm_handle_xsetbv(), namely make it return a proper error code. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> Acked-by: Kevin Tian <kevin.tian@xxxxxxxxx> --- xen/arch/x86/hvm/hvm.c | 19 ++++++------------- xen/arch/x86/hvm/svm/svm.c | 9 +++++---- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index db0aeba..af3d4d7 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -3153,22 +3153,15 @@ out: int hvm_handle_xsetbv(u32 index, u64 new_bv) { - struct segment_register sreg; - struct vcpu *curr = current; - - hvm_get_segment_register(curr, x86_seg_ss, &sreg); - if ( sreg.attr.fields.dpl != 0 ) - goto err; + int rc; - hvm_event_crX(XCR0, new_bv, curr->arch.xcr0); + hvm_event_crX(XCR0, new_bv, current->arch.xcr0); - if ( handle_xsetbv(index, new_bv) ) - goto err; + rc = handle_xsetbv(index, new_bv); + if ( rc ) + hvm_inject_hw_exception(TRAP_gp_fault, 0); - return 0; -err: - hvm_inject_hw_exception(TRAP_gp_fault, 0); - return -1; + return rc; } int hvm_set_efer(uint64_t value) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 200a5df..9415fb1 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -2612,10 +2612,11 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) break; case VMEXIT_XSETBV: - if ( (inst_len = __get_instruction_length(current, INSTR_XSETBV))==0 ) - break; - if ( hvm_handle_xsetbv(regs->ecx, - (regs->rdx << 32) | regs->_eax) == 0 ) + if ( vmcb_get_cpl(vmcb) ) + hvm_inject_hw_exception(TRAP_gp_fault, 0); + else if ( (inst_len = __get_instruction_length(v, INSTR_XSETBV)) && + hvm_handle_xsetbv(regs->ecx, + (regs->rdx << 32) | regs->_eax) == 0 ) __update_guest_eip(regs, inst_len); break; -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |