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>] [day] [month] [year] [list]
Message-ID: <20200318052509.GA23121@juliacomputing.com>
Date:   Wed, 18 Mar 2020 01:25:09 -0400
From:   Keno Fischer <keno@...iacomputing.com>
To:     linux-kernel@...r.kernel.org
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "H. Peter Anvin" <hpa@...or.com>, x86@...nel.org, cl@...ux.com,
        Tejun Heo <tj@...nel.org>
Subject: [PATCH] x86/percpu: Fix assembly in variable_test_bit

I was trying to compile the kernel with -Og for a better debugging
experience. One side effect of this that the compiler will no longer
do as aggressive dead code elimination, so assembly blocks that were
previously dce'd remained in the final assembly. There's quite a number
of places in the kernel that rely on this dce happening, so it's not
clear that this should be a supported configuration. Nevertheless,
in this particular instance, I believe it found a real issue. In
particular, I believe the `__percpu_arg` macro should be on the
memory operand rather than the immediate. As far as I can tell,
this was never correct, but just happened to be always dce'd out
because the cpu_test macro is generally only used with constant
`nr` arguments.

Fixes: 349c004e3d31 ("x86: A fast way to check capabilities of the current cpu")
Signed-off-by: Keno Fischer <keno@...iacomputing.com>
---
 arch/x86/include/asm/percpu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
index 2278797c769d..17c7677e6cdd 100644
--- a/arch/x86/include/asm/percpu.h
+++ b/arch/x86/include/asm/percpu.h
@@ -539,7 +539,7 @@ static inline bool x86_this_cpu_variable_test_bit(int nr,
 {
 	bool oldbit;
 
-	asm volatile("btl "__percpu_arg(2)",%1"
+	asm volatile("btl %2,"__percpu_arg(1)"\n\t"
 			CC_SET(c)
 			: CC_OUT(c) (oldbit)
 			: "m" (*(unsigned long __percpu *)addr), "Ir" (nr));
-- 
2.24.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ