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: <20181023003725.21463-1-natechancellor@gmail.com>
Date:   Mon, 22 Oct 2018 17:37:26 -0700
From:   Nathan Chancellor <natechancellor@...il.com>
To:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>
Cc:     "H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
        linux-kernel@...r.kernel.org, Nadav Amit <namit@...are.com>,
        Kees Cook <keescook@...omium.org>,
        Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Nathan Chancellor <natechancellor@...il.com>
Subject: [PATCH RFC] x86: Don't include '-Wa,-' when building with Clang

Commit 77b0bf55bc67 ("kbuild/Makefile: Prepare for using macros in
inline assembly code to work around asm() related GCC inlining bugs")
added this flag to KBUILD_CFLAGS, where it works perfectly fine with
GCC. However, when building with Clang, all of the object files compile
fine but the build hangs indefinitely at init/main.o, right before the
linking stage. Don't include this flag when building with Clang.

The kernel builds and boots to a shell in QEMU with both GCC and Clang
with this patch applied.

Link: https://github.com/ClangBuiltLinux/linux/issues/213
Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
---

The reason this patch is labeled RFC is while I can verify that this
fixes the issue, I'm not entirely sure why the '-Wa,-' works for GCC
and not Clang. I looked into what the flag means and I couldn't really
find anything so I just assume it's taking input from stdin? The issue
could stem from how GCC forks gas versus how Clang does it. If this
isn't of concern and the maintainers are happy with this patch as is,
feel free to take it.

 arch/x86/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 5b562e464009..4736dcc1caec 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -239,7 +239,10 @@ archheaders:
 archmacros:
 	$(Q)$(MAKE) $(build)=arch/x86/kernel arch/x86/kernel/macros.s
 
-ASM_MACRO_FLAGS = -Wa,arch/x86/kernel/macros.s -Wa,-
+ASM_MACRO_FLAGS = -Wa,arch/x86/kernel/macros.s
+ifneq ($(cc-name),clang)
+ASM_MACRO_FLAGS += -Wa,-
+endif
 export ASM_MACRO_FLAGS
 KBUILD_CFLAGS += $(ASM_MACRO_FLAGS)
 
-- 
2.19.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ