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] [day] [month] [year] [list]
Message-Id: <1403101194-23707-4-git-send-email-namit@cs.technion.ac.il>
Date:	Wed, 18 Jun 2014 17:19:52 +0300
From:	Nadav Amit <namit@...technion.ac.il>
To:	pbonzini@...hat.com
Cc:	gleb@...nel.org, tglx@...utronix.de, mingo@...hat.com,
	hpa@...or.com, x86@...nel.org, linux-kernel@...r.kernel.org,
	kvm@...r.kernel.org, Nadav Amit <namit@...technion.ac.il>
Subject: [PATCH kvm-unit-tests 3/5] x86: Test btcq with operand larger than 64

Previously, KVM did not calculate the offset for bit-operations correctly when
quad-word operands were used.  This test checks btcq when operand is larger
than 64 in order to check this scenario.

Signed-off-by: Nadav Amit <namit@...technion.ac.il>
---
 x86/emulator.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/x86/emulator.c b/x86/emulator.c
index bf8a873..460949f 100644
--- a/x86/emulator.c
+++ b/x86/emulator.c
@@ -496,7 +496,7 @@ void test_btc(void *mem)
 {
 	unsigned int *a = mem;
 
-	memset(mem, 0, 3 * sizeof(unsigned int));
+	memset(mem, 0, 4 * sizeof(unsigned int));
 
 	asm ("btcl $32, %0" :: "m"(a[0]) : "memory");
 	asm ("btcl $1, %0" :: "m"(a[1]) : "memory");
@@ -505,6 +505,10 @@ void test_btc(void *mem)
 
 	asm ("btcl %1, %0" :: "m"(a[3]), "r"(-1) : "memory");
 	report("btcl reg, r/m", a[0] == 1 && a[1] == 2 && a[2] == 0x80000004);
+
+	asm ("btcq %1, %0" : : "m"(a[2]), "r"(-1l) : "memory");
+	report("btcq reg, r/m", a[0] == 1 && a[1] == 0x80000002 &&
+		a[2] == 0x80000004 && a[3] == 0);
 }
 
 void test_bsfbsr(void *mem)
-- 
1.9.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