Skip to content

Commit

Permalink
KVM: emulator: drop RPL check from linearize() function
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Gleb Natapov authored and Marcelo Tosatti committed Jan 2, 2013
1 parent 11393a0 commit 3a78a4f
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ static int __linearize(struct x86_emulate_ctxt *ctxt,
ulong la;
u32 lim;
u16 sel;
unsigned cpl, rpl;
unsigned cpl;

la = seg_base(ctxt, addr.seg) + addr.ea;
switch (ctxt->mode) {
Expand Down Expand Up @@ -699,11 +699,6 @@ static int __linearize(struct x86_emulate_ctxt *ctxt,
goto bad;
}
cpl = ctxt->ops->cpl(ctxt);
if (ctxt->mode == X86EMUL_MODE_REAL)
rpl = 0;
else
rpl = sel & 3;
cpl = max(cpl, rpl);
if (!(desc.type & 8)) {
/* data segment */
if (cpl > desc.dpl)
Expand Down

0 comments on commit 3a78a4f

Please sign in to comment.