FAILED: patch "[PATCH] KVM: x86: fix singlestepping over syscall" failed to apply to 4.9-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
Quoted 1 line
From
c8401dda2f0a00cd25c0af6a95ed50e478d25de4Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <[email protected]>
Date: Wed, 7 Jun 2017 15:13:14 +0200
Subject: [PATCH] KVM: x86: fix singlestepping over syscall
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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.
arch/x86/include/asm/kvm_emulate.h +1 -0
@@ -296,6 +296,7 @@ struct x86_emulate_ctxt {bool perm_ok;/* do not check permissions if true */ bool ud;/* inject an #UD if host doesn't support insn */ +bool tf;/* TF value before instruction (after for syscall/sysret) */ bool have_exception;struct x86_exception exception;
arch/x86/kvm/emulate.c +1 -0
@@ -2742,6 +2742,7 @@ static int em_syscall(struct x86_emulate_ctxt *ctxt) ctxt->eflags &= ~(X86_EFLAGS_VM |X86_EFLAGS_IF ); } + ctxt->tf = (ctxt->eflags &X86_EFLAGS_TF ) !=0 ;return X86EMUL_CONTINUE ; }
arch/x86/kvm/x86.c +32 -30
89 lines not on this page · raw message