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-next>] [day] [month] [year] [list]
Date:   Wed, 14 Feb 2018 12:50:10 -0800
From:   Dan Williams <dan.j.williams@...el.com>
To:     mingo@...nel.org
Cc:     Andi Kleen <ak@...ux.intel.com>, x86@...nel.org,
        linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [PATCH] x86,
 nospec: Fix uninitialized mask in array_index_mask_nospec()

Break the false dependency on the uninitialized value of 'mask' in
array_index_mask_nospec(). This potentially allows the CPU to rename the
register, avoids reports from tools that can detect uninitialized inline
asm arguments, and makes it explicit that this sequence wants the result
of (0 - 0 - CARRY).

Reported-by: Andi Kleen <ak@...ux.intel.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: x86@...nel.org
Signed-off-by: Dan Williams <dan.j.williams@...el.com>
---
 arch/x86/include/asm/barrier.h |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h
index e1259f043ae9..b572b6a77e12 100644
--- a/arch/x86/include/asm/barrier.h
+++ b/arch/x86/include/asm/barrier.h
@@ -36,10 +36,10 @@
 static inline unsigned long array_index_mask_nospec(unsigned long index,
 		unsigned long size)
 {
-	unsigned long mask;
+	unsigned long mask = 0;
 
-	asm ("cmp %1,%2; sbb %0,%0;"
-			:"=r" (mask)
+	asm ("cmp %1,%2; sbb $0,%0;"
+			:"+r" (mask)
 			:"g"(size),"r" (index)
 			:"cc");
 	return mask;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ