Skip to content

Commit

Permalink
KVM: x86: Non-canonical access using SS should cause #SS
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nadav Amit authored and Paolo Bonzini committed Nov 19, 2014
1 parent d50eaa1 commit abc7d8a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit abc7d8a

Please sign in to comment.