Linux/linux c8401ddarch/x86/include/asm kvm_emulate.h, arch/x86/kvm x86.c emulate.c

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 at vger.kernel.org
Reported-by: Andy Lutomirski <luto at kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar at redhat.com>
DeltaFile
+32-30arch/x86/kvm/x86.c
+1-0arch/x86/include/asm/kvm_emulate.h
+1-0arch/x86/kvm/emulate.c
+34-303 files

UnifiedSplitRaw