dect
/
linux-2.6
Archived
13
0
Fork 0

KVM: emulator: fix real mode segment checks in address linearization

In real mode CS register is writable, so do not #GP on write.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
Gleb Natapov 2012-12-11 15:14:12 +02:00 committed by Marcelo Tosatti
parent 0b26b588d9
commit 58b7825bc3
1 changed files with 3 additions and 2 deletions

View File

@ -677,8 +677,9 @@ static int __linearize(struct x86_emulate_ctxt *ctxt,
addr.seg);
if (!usable)
goto bad;
/* code segment or read-only data segment */
if (((desc.type & 8) || !(desc.type & 2)) && write)
/* code segment in protected mode or read-only data segment */
if ((((ctxt->mode != X86EMUL_MODE_REAL) && (desc.type & 8))
|| !(desc.type & 2)) && write)
goto bad;
/* unreadable code segment */
if (!fetch && (desc.type & 8) && !(desc.type & 2))