[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200819191654.1130563-1-ndesaulniers@google.com>
Date: Wed, 19 Aug 2020 12:16:49 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Masahiro Yamada <masahiroy@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>
Cc: Michal Marek <michal.lkml@...kovi.net>,
linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
Kees Cook <keescook@...omium.org>,
Tony Luck <tony.luck@...el.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Michael Ellerman <mpe@...erman.id.au>,
Joe Perches <joe@...ches.com>,
Joel Fernandes <joel@...lfernandes.org>,
Daniel Axtens <dja@...ens.net>,
Arvind Sankar <nivedita@...m.mit.edu>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Alexandru Ardelean <alexandru.ardelean@...log.com>,
Yury Norov <yury.norov@...il.com>, x86@...nel.org,
"H . Peter Anvin" <hpa@...or.com>,
Ard Biesheuvel <ardb@...nel.org>,
"Paul E . McKenney" <paulmck@...nel.org>,
Daniel Kiper <daniel.kiper@...cle.com>,
Bruce Ashfield <bruce.ashfield@...il.com>,
Marco Elver <elver@...gle.com>,
Vamshi K Sthambamkadi <vamshi.k.sthambamkadi@...il.com>,
Andi Kleen <ak@...e.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
"Dávid Bolvanský" <david.bolvansky@...il.com>,
Eli Friedman <efriedma@...cinc.com>,
Nick Desaulniers <ndesaulniers@...gle.com>
Subject: [PATCH v2 0/5] -ffreestanding/-fno-builtin-* patches
A recent "libcall optimization" addition to LLVM will emit libcalls to
stpcpy, which the kernel doesn't provide an implementation, breaking
almost all kernel builds with ToT Clang. Disable it for clang.
We discussed providing an implementation, but the interface is generally
unsafe as it provides no bounds checking.
-fno-builtin-foo doesn't prevent GCC from emitting calls to foo, and GCC
doesn't currently do the same libcall optimizations. If it ever does,
then we can resurrect these implementations, but right now, YAGNI. So we
only add these flags to CLANG_FLAGS to solve a Clang specific issue.
The first patch is critical, I'm hoping Masahiro will pick it for the
Kbuild tree and help us to get the fix in 5.9.
The rest are cleanups; sending them for feedback/review/testing. Once
the first hits mainline, I plan to resend the rest to the x86
maintainers for inclusion in tip.
Nick Desaulniers (5):
Makefile: add -fno-builtin-stpcpy
Makefile: add -fno-builtin-bcmp
Revert "lib/string.c: implement a basic bcmp"
x86/boot: use -fno-builtin-bcmp
x86: don't build CONFIG_X86_32 as -ffreestanding
Makefile | 2 ++
arch/x86/Makefile | 3 ---
arch/x86/boot/Makefile | 1 +
arch/x86/boot/string.c | 8 --------
include/linux/string.h | 3 ---
lib/string.c | 20 --------------------
6 files changed, 3 insertions(+), 34 deletions(-)
--
2.28.0.297.g1956fa8f8d-goog
Powered by blists - more mailing lists