73291eb01a
automatically update UEFI boot binary xen.spec - Upstream patches from Jan 51d5334e-x86-mm-Ensure-useful-progress-in-alloc_l2_table.patch 51dd155c-adjust-x86-EFI-build.patch 51e63d80-x86-cpuidle-Change-logging-for-unknown-APIC-IDs.patch 51e6540d-x86-don-t-use-destroy_xen_mappings-for-vunmap.patch 51e7963f-x86-time-Update-wallclock-in-shared-info-when-altering-domain-time-offset.patch 51ffd577-fix-off-by-one-mistakes-in-vm_alloc.patch 51ffd5fd-x86-refine-FPU-selector-handling-code-for-XSAVEOPT.patch 520114bb-Nested-VMX-Flush-TLBs-and-Caches-if-paging-mode-changed.patch 520a5504-VMX-add-boot-parameter-to-enable-disable-APIC-v-dynamically.patch 520a24f6-x86-AMD-Fix-nested-svm-crash-due-to-assertion-in-__virt_to_maddr.patch 520a2570-x86-AMD-Inject-GP-instead-of-UD-when-unable-to-map-vmcb.patch 520b4b60-VT-d-protect-against-bogus-information-coming-from-BIOS.patch 520b4bda-x86-MTRR-fix-range-check-in-mtrr_add_page.patch 520cb8b6-x86-time-fix-check-for-negative-time-in-__update_vcpu_system_time.patch 520d417d-xen-Add-stdbool.h-workaround-for-BSD.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=266
92 lines
3.3 KiB
Diff
92 lines
3.3 KiB
Diff
# Commit 910daaf5aaa837624099c0fc5c373bea7202ff43
|
|
# Date 2013-08-13 14:24:16 +0200
|
|
# Author Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
|
|
# Committer Jan Beulich <jbeulich@suse.com>
|
|
x86/AMD: Inject #GP instead of #UD when unable to map vmcb
|
|
|
|
According to AMD Programmer's Manual vol2, vmrun, vmsave and vmload
|
|
should inject #GP instead of #UD when unable to access memory
|
|
location for vmcb. Also, the code should make sure that L1 guest
|
|
EFER.SVME is not zero. Otherwise, #UD should be injected.
|
|
|
|
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
|
|
Reviewed-by: Tim Deegan <tim@xen.org>
|
|
|
|
--- a/xen/arch/x86/hvm/svm/svm.c
|
|
+++ b/xen/arch/x86/hvm/svm/svm.c
|
|
@@ -1776,15 +1776,17 @@ static void
|
|
svm_vmexit_do_vmrun(struct cpu_user_regs *regs,
|
|
struct vcpu *v, uint64_t vmcbaddr)
|
|
{
|
|
- if (!nestedhvm_enabled(v->domain)) {
|
|
+ if ( !nsvm_efer_svm_enabled(v) )
|
|
+ {
|
|
gdprintk(XENLOG_ERR, "VMRUN: nestedhvm disabled, injecting #UD\n");
|
|
hvm_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE);
|
|
return;
|
|
}
|
|
|
|
- if (!nestedsvm_vmcb_map(v, vmcbaddr)) {
|
|
- gdprintk(XENLOG_ERR, "VMRUN: mapping vmcb failed, injecting #UD\n");
|
|
- hvm_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE);
|
|
+ if ( !nestedsvm_vmcb_map(v, vmcbaddr) )
|
|
+ {
|
|
+ gdprintk(XENLOG_ERR, "VMRUN: mapping vmcb failed, injecting #GP\n");
|
|
+ hvm_inject_hw_exception(TRAP_gp_fault, HVM_DELIVER_NO_ERROR_CODE);
|
|
return;
|
|
}
|
|
|
|
@@ -1830,7 +1832,8 @@ svm_vmexit_do_vmload(struct vmcb_struct
|
|
if ( (inst_len = __get_instruction_length(v, INSTR_VMLOAD)) == 0 )
|
|
return;
|
|
|
|
- if (!nestedhvm_enabled(v->domain)) {
|
|
+ if ( !nsvm_efer_svm_enabled(v) )
|
|
+ {
|
|
gdprintk(XENLOG_ERR, "VMLOAD: nestedhvm disabled, injecting #UD\n");
|
|
ret = TRAP_invalid_op;
|
|
goto inject;
|
|
@@ -1840,8 +1843,8 @@ svm_vmexit_do_vmload(struct vmcb_struct
|
|
if ( !page )
|
|
{
|
|
gdprintk(XENLOG_ERR,
|
|
- "VMLOAD: mapping failed, injecting #UD\n");
|
|
- ret = TRAP_invalid_op;
|
|
+ "VMLOAD: mapping failed, injecting #GP\n");
|
|
+ ret = TRAP_gp_fault;
|
|
goto inject;
|
|
}
|
|
|
|
@@ -1871,7 +1874,8 @@ svm_vmexit_do_vmsave(struct vmcb_struct
|
|
if ( (inst_len = __get_instruction_length(v, INSTR_VMSAVE)) == 0 )
|
|
return;
|
|
|
|
- if (!nestedhvm_enabled(v->domain)) {
|
|
+ if ( !nsvm_efer_svm_enabled(v) )
|
|
+ {
|
|
gdprintk(XENLOG_ERR, "VMSAVE: nestedhvm disabled, injecting #UD\n");
|
|
ret = TRAP_invalid_op;
|
|
goto inject;
|
|
@@ -1881,8 +1885,8 @@ svm_vmexit_do_vmsave(struct vmcb_struct
|
|
if ( !page )
|
|
{
|
|
gdprintk(XENLOG_ERR,
|
|
- "VMSAVE: mapping vmcb failed, injecting #UD\n");
|
|
- ret = TRAP_invalid_op;
|
|
+ "VMSAVE: mapping vmcb failed, injecting #GP\n");
|
|
+ ret = TRAP_gp_fault;
|
|
goto inject;
|
|
}
|
|
|
|
--- a/xen/include/asm-x86/hvm/svm/nestedsvm.h
|
|
+++ b/xen/include/asm-x86/hvm/svm/nestedsvm.h
|
|
@@ -94,7 +94,7 @@ struct nestedsvm {
|
|
#define vcpu_nestedsvm(v) (vcpu_nestedhvm(v).u.nsvm)
|
|
|
|
/* True when l1 guest enabled SVM in EFER */
|
|
-#define hvm_svm_enabled(v) \
|
|
+#define nsvm_efer_svm_enabled(v) \
|
|
(!!((v)->arch.hvm_vcpu.guest_efer & EFER_SVME))
|
|
|
|
int nestedsvm_vmcb_map(struct vcpu *v, uint64_t vmcbaddr);
|