aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2012-12-20 09:57:42 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2013-01-02 16:36:26 -0500
commit3a78a4f46302bfc83602a53dfa4dcbe76a7a1f5f (patch)
tree02a2afcdcc0761259195bb2413b4996a045fcf4a
parent11393a077dcfa7fb827d957f0305fc369d402a5e (diff)
KVM: emulator: drop RPL check from linearize() function
According to Intel SDM Vol3 Section 5.5 "Privilege Levels" and 5.6 "Privilege Level Checking When Accessing Data Segments" RPL checking is done during loading of a segment selector, not during data access. We already do checking during segment selector loading, so drop the check during data access. Checking RPL during data access triggers #GP if after transition from real mode to protected mode RPL bits in a segment selector are set. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r--arch/x86/kvm/emulate.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index c7547b3fd527..a3d31e3d9875 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -665,7 +665,7 @@ static int __linearize(struct x86_emulate_ctxt *ctxt,
665 ulong la; 665 ulong la;
666 u32 lim; 666 u32 lim;
667 u16 sel; 667 u16 sel;
668 unsigned cpl, rpl; 668 unsigned cpl;
669 669
670 la = seg_base(ctxt, addr.seg) + addr.ea; 670 la = seg_base(ctxt, addr.seg) + addr.ea;
671 switch (ctxt->mode) { 671 switch (ctxt->mode) {
@@ -699,11 +699,6 @@ static int __linearize(struct x86_emulate_ctxt *ctxt,
699 goto bad; 699 goto bad;
700 } 700 }
701 cpl = ctxt->ops->cpl(ctxt); 701 cpl = ctxt->ops->cpl(ctxt);
702 if (ctxt->mode == X86EMUL_MODE_REAL)
703 rpl = 0;
704 else
705 rpl = sel & 3;
706 cpl = max(cpl, rpl);
707 if (!(desc.type & 8)) { 702 if (!(desc.type & 8)) {
708 /* data segment */ 703 /* data segment */
709 if (cpl > desc.dpl) 704 if (cpl > desc.dpl)