]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: x86: fix singlestepping over syscall
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 7 Jun 2017 13:13:14 +0000 (15:13 +0200)
committerJack Vogel <jack.vogel@oracle.com>
Fri, 23 Mar 2018 05:19:45 +0000 (22:19 -0700)
commit69204dc9decaa83dc84976364c21226dcbc88f6f
tree5ae5fe0155f2f2190a31fbf0727c98199d64c80a
parent1f0a55c2688a0556822c5440ce73ccb91c0b949b
KVM: x86: fix singlestepping over syscall

TF is handled a bit differently for syscall and sysret, compared
to the other instructions: TF is checked after the instruction completes,
so that the OS can disable #DB at a syscall by adding TF to FMASK.
When the sysret is executed the #DB is taken "as if" the syscall insn
just completed.

KVM emulates syscall so that it can trap 32-bit syscall on Intel processors.
Fix the behavior, otherwise you could get #DB on a user stack which is not
nice.  This does not affect Linux guests, as they use an IST or task gate
for #DB.

This fixes CVE-2017-7518.

Cc: stable@vger.kernel.org
Reported-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
(cherry picked from commit c8401dda2f0a00cd25c0af6a95ed50e478d25de4)

Orabug: 27669904
CVE: CVE-2017-7518

Signed-off-by: Kirtikar Kashyap <kirtikar.kashyap@oracle.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
 Conflicts:
arch/x86/kvm/x86.c
skipped changes for kvm_skip_emulated_instruction()
arch/x86/include/asm/kvm_emulate.h
arch/x86/kvm/emulate.c
arch/x86/kvm/x86.c