KVM: x86: Non-canonical access using SS should cause #SS
authorNadav Amit <namit@cs.technion.ac.il>
Wed, 19 Nov 2014 15:43:12 +0000 (17:43 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 19 Nov 2014 17:19:57 +0000 (18:19 +0100)
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 <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/emulate.c

index 4d083fb9dd8e2886b46ac3eb3ea153761ea79c01..57dc0d79c10ea88d2a0d67f69d4769908f448bb9 100644 (file)
@@ -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)