Skip to contentSkip to conversation

KVM: x86 emulator: refuse SrcMemFAddr (e.g. LDS) with register operand

PATCH Applied Avi Kivity 2 participants 2 messages Aug 26, 2010

Subsystems (3)
lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 KVM: x86 emulator: refuse SrcMemFAddr (e.g. LDS) with register operand

SrcMemFAddr is not defined with the modrm operand designating a register instead of a memory address.

---
 arch/x86/kvm/emulate.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
arch/x86/kvm/emulate.c +5 -0
index d613690..36b0e29 100644
@@ -2957,6 +2957,11 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
 		goto done;
 	}
 
+	if ((c->d & SrcMask) == SrcMemFAddr && c->src.type != OP_MEM) {
+		emulate_ud(ctxt);
+		goto done;
+	}
+
 	/* Privileged instruction can be executed only in CPL=0 */
 	if ((c->d & Priv) && ops->cpl(ctxt->vcpu)) {
 		emulate_gp(ctxt, 0);
Signature · 1 line
1.7.1
#1 lore raw
Quoted 7 lines · Avi Kivity

SrcMemFAddr is not defined with the modrm operand designating a register instead of a memory address.

---
 arch/x86/kvm/emulate.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Applied, thanks.