]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: x86: fix singlestepping over syscall
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 7 Jun 2017 13:13:14 +0000 (15:13 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Jun 2017 11:02:46 +0000 (13:02 +0200)
commit3af2b32a50c23af81403e6fed880f18e9ae0cb30
tree675aa339b373a6901496c0ea955ae67b151c8163
parent75d735389044a333d6ecd44e03fb25f8b413bf92
KVM: x86: fix singlestepping over syscall

commit c8401dda2f0a00cd25c0af6a95ed50e478d25de4 upstream.

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.

Reported-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/include/asm/kvm_emulate.h
arch/x86/kvm/emulate.c
arch/x86/kvm/x86.c