From b09f902d4744a7b271480b82d37e19441c887e14 Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Tue, 11 Dec 2012 15:14:12 +0200 Subject: [PATCH] --- yaml --- r: 343596 b: refs/heads/master c: 58b7825bc324da55415034a9f6ca5d716b8fd898 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/x86/kvm/emulate.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index d764d8b19507..3659ef1e4ab3 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0b26b588d97031fe8e16a35186220a6c14c89849 +refs/heads/master: 58b7825bc324da55415034a9f6ca5d716b8fd898 diff --git a/trunk/arch/x86/kvm/emulate.c b/trunk/arch/x86/kvm/emulate.c index 39171cb307ea..979869f70468 100644 --- a/trunk/arch/x86/kvm/emulate.c +++ b/trunk/arch/x86/kvm/emulate.c @@ -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))