From abc7d8a4c935dbe0be5db2eb338b2ec9b27ae157 Mon Sep 17 00:00:00 2001 From: Nadav Amit Date: Wed, 19 Nov 2014 17:43:12 +0200 Subject: [PATCH] KVM: x86: Non-canonical access using SS should cause #SS When SS is used using a non-canonical address, an #SS exception is generated on real hardware. KVM emulator causes a #GP instead. Fix it to behave as real x86 CPU. Signed-off-by: Nadav Amit Signed-off-by: Paolo Bonzini --- arch/x86/kvm/emulate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 4d083fb9dd8e..57dc0d79c10e 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -635,7 +635,7 @@ static __always_inline int __linearize(struct x86_emulate_ctxt *ctxt, switch (mode) { case X86EMUL_MODE_PROT64: if (is_noncanonical_address(la)) - return emulate_gp(ctxt, 0); + goto bad; *max_size = min_t(u64, ~0u, (1ull << 48) - la); if (size > *max_size) -- 2.39.5