diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2014-10-27 09:40:49 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-10-29 07:40:28 -0400 |
commit | 3606189fa3da6afcad0cbbc9b91e94f1f158da5a (patch) | |
tree | db65b7ea305f2412439720b7c6715c44dca46eb2 /arch | |
parent | cac7f2429872d3733dc3f9915857b1691da2eb2f (diff) |
KVM: emulator: fix error code for __linearize
The error code for #GP and #SS is zero when the segment is used to
access an operand or an instruction. It is only non-zero when
a segment register is being loaded; for limit checks this means
cases such as:
* for #GP, when RIP is beyond the limit on a far call (before the first
instruction is executed). We do not implement this check, but it
would be in em_jmp_far/em_call_far.
* for #SS, if the new stack overflows during an inter-privilege-level
call to a non-conforming code segment. We do not implement stack
switching at all.
So use an error code of zero.
Reviewed-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kvm/emulate.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 749f9fa38254..8aa66068712f 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -711,9 +711,9 @@ static int __linearize(struct x86_emulate_ctxt *ctxt, | |||
711 | return X86EMUL_CONTINUE; | 711 | return X86EMUL_CONTINUE; |
712 | bad: | 712 | bad: |
713 | if (addr.seg == VCPU_SREG_SS) | 713 | if (addr.seg == VCPU_SREG_SS) |
714 | return emulate_ss(ctxt, sel); | 714 | return emulate_ss(ctxt, 0); |
715 | else | 715 | else |
716 | return emulate_gp(ctxt, sel); | 716 | return emulate_gp(ctxt, 0); |
717 | } | 717 | } |
718 | 718 | ||
719 | static int linearize(struct x86_emulate_ctxt *ctxt, | 719 | static int linearize(struct x86_emulate_ctxt *ctxt, |