Commit abc7d8a4 authored by Nadav Amit's avatar Nadav Amit Committed by Paolo Bonzini

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: default avatarNadav Amit <namit@cs.technion.ac.il>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent d50eaa18
...@@ -635,7 +635,7 @@ static __always_inline int __linearize(struct x86_emulate_ctxt *ctxt, ...@@ -635,7 +635,7 @@ static __always_inline int __linearize(struct x86_emulate_ctxt *ctxt,
switch (mode) { switch (mode) {
case X86EMUL_MODE_PROT64: case X86EMUL_MODE_PROT64:
if (is_noncanonical_address(la)) if (is_noncanonical_address(la))
return emulate_gp(ctxt, 0); goto bad;
*max_size = min_t(u64, ~0u, (1ull << 48) - la); *max_size = min_t(u64, ~0u, (1ull << 48) - la);
if (size > *max_size) if (size > *max_size)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment