lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1384872810-29492-3-git-send-email-alonid@stratoscale.com>
Date:	Tue, 19 Nov 2013 16:53:30 +0200
From:	Dan Aloni <alonid@...atoscale.com>
To:	linux-kernel@...r.kernel.org
Cc:	kvm@...r.kernel.org, kgdb-bugreport@...ts.sourceforge.net,
	x86@...nel.org, gleb@...hat.com, pbonzini@...hat.com,
	tglx@...utronix.de, mingo@...hat.com, hpa@...or.com,
	Muli Ben-Yehuda <muli@...atoscale.com>
Subject: [PATCH linux-next 2/2] kvm-x86: emulator: disable kgdb-x86 on fastop and fpe flush

We have seen that when kvm-unit-tests runs with kgdb enabled, the
kernel halts on the debugger during the KVM x86 instruction emulation
that performs a test of a division by zero, and also during fwait.

This patch adds calls that temporarily disable the debugger trap.

Signed-off-by: Dan Aloni <alonid@...atoscale.com>
Signed-off-by: Muli Ben-Yehuda <muli@...atoscale.com>
---
 arch/x86/kvm/emulate.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 07ffca0..05e8509 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -24,6 +24,7 @@
 #include "kvm_cache_regs.h"
 #include <linux/module.h>
 #include <asm/kvm_emulate.h>
+#include <asm/kgdb.h>
 #include <linux/stringify.h>
 
 #include "x86.h"
@@ -4438,6 +4439,7 @@ static int flush_pending_x87_faults(struct x86_emulate_ctxt *ctxt)
 {
 	bool fault = false;
 
+	kgdb_ll_local_disable();
 	ctxt->ops->get_fpu(ctxt);
 	asm volatile("1: fwait \n\t"
 		     "2: \n\t"
@@ -4449,6 +4451,7 @@ static int flush_pending_x87_faults(struct x86_emulate_ctxt *ctxt)
 		     _ASM_EXTABLE(1b, 3b)
 		     : [fault]"+qm"(fault));
 	ctxt->ops->put_fpu(ctxt);
+	kgdb_ll_local_enable();
 
 	if (unlikely(fault))
 		return emulate_exception(ctxt, MF_VECTOR, 0, false);
@@ -4468,10 +4471,14 @@ static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *))
 	ulong flags = (ctxt->eflags & EFLAGS_MASK) | X86_EFLAGS_IF;
 	if (!(ctxt->d & ByteOp))
 		fop += __ffs(ctxt->dst.bytes) * FASTOP_SIZE;
+
+	kgdb_ll_local_disable();
 	asm("push %[flags]; popf; call *%[fastop]; pushf; pop %[flags]\n"
 	    : "+a"(ctxt->dst.val), "+d"(ctxt->src.val), [flags]"+D"(flags),
 	      [fastop]"+S"(fop)
 	    : "c"(ctxt->src2.val));
+	kgdb_ll_local_enable();
+
 	ctxt->eflags = (ctxt->eflags & ~EFLAGS_MASK) | (flags & EFLAGS_MASK);
 	if (!fop) /* exception is returned in fop variable */
 		return emulate_de(ctxt);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ