[PATCH 4/9] KVM: SVM: Add intercept checks for descriptor table accesses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch adds checks for accesses to the descriptor table
base registers to the intruction emulator path of KVM.

Signed-off-by: Joerg Roedel <joerg.roedel@xxxxxxx>
---
 arch/x86/kvm/svm.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 16ff569..035c5b5 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -3636,12 +3636,40 @@ static int svm_insn_intercepted(struct kvm_vcpu *vcpu,
 		goto out;
 
 	switch (c->b) {
+	case 0x00:
+		switch (c->modrm_reg) {
+		case 0x00: /* SLDT */
+			vmcb->control.exit_code = SVM_EXIT_LDTR_READ;
+			break;
+		case 0x01: /* STR */
+			vmcb->control.exit_code = SVM_EXIT_TR_READ;
+			break;
+		case 0x02: /* LLDT */
+			vmcb->control.exit_code = SVM_EXIT_LDTR_WRITE;
+			break;
+		case 0x03: /* LTR */
+			vmcb->control.exit_code = SVM_EXIT_TR_WRITE;
+			break;
+		}
+		break;
 	case 0x01:
 		/* 0x0f 0x01 and modrm_mod == 3 encodes special instructions */
 		if (c->modrm_mod == 3)
 			break;
 
 		switch (c->modrm_reg) {
+		case 0x00: /* SGDT */
+			vmcb->control.exit_code = SVM_EXIT_GDTR_READ;
+			break;
+		case 0x01: /* SIDT */
+			vmcb->control.exit_code = SVM_EXIT_IDTR_READ;
+			break;
+		case 0x02: /* LGDT */
+			vmcb->control.exit_code = SVM_EXIT_GDTR_WRITE;
+			break;
+		case 0x03: /* LIDT */
+			vmcb->control.exit_code = SVM_EXIT_IDTR_WRITE;
+			break;
 		case 0x04: /* SMSW */
 			vmcb->control.exit_code = SVM_EXIT_READ_CR0;
 			break;
-- 
1.7.1


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux