diff options
author | Gleb Natapov <gleb@redhat.com> | 2012-12-11 08:14:12 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2012-12-11 18:00:28 -0500 |
commit | 58b7825bc324da55415034a9f6ca5d716b8fd898 (patch) | |
tree | 819453213ec9f5c68eae10088467f1abe75d9cb4 | |
parent | 0b26b588d97031fe8e16a35186220a6c14c89849 (diff) |
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>
-rw-r--r-- | arch/x86/kvm/emulate.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 39171cb307ea..979869f70468 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -677,8 +677,9 @@ static int __linearize(struct x86_emulate_ctxt *ctxt, | |||
677 | addr.seg); | 677 | addr.seg); |
678 | if (!usable) | 678 | if (!usable) |
679 | goto bad; | 679 | goto bad; |
680 | /* code segment or read-only data segment */ | 680 | /* code segment in protected mode or read-only data segment */ |
681 | if (((desc.type & 8) || !(desc.type & 2)) && write) | 681 | if ((((ctxt->mode != X86EMUL_MODE_REAL) && (desc.type & 8)) |
682 | || !(desc.type & 2)) && write) | ||
682 | goto bad; | 683 | goto bad; |
683 | /* unreadable code segment */ | 684 | /* unreadable code segment */ |
684 | if (!fetch && (desc.type & 8) && !(desc.type & 2)) | 685 | if (!fetch && (desc.type & 8) && !(desc.type & 2)) |