linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] -ffreestanding/-fno-builtin-* patches
@ 2020-08-19 19:16 Nick Desaulniers
  2020-08-19 19:16 ` [PATCH v2 1/5] Makefile: add -fno-builtin-stpcpy Nick Desaulniers
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Nick Desaulniers @ 2020-08-19 19:16 UTC (permalink / raw)
  To: Masahiro Yamada, Andrew Morton, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov
  Cc: Michal Marek, linux-kbuild, linux-kernel, Kees Cook, Tony Luck,
	Dmitry Vyukov, Michael Ellerman, Joe Perches, Joel Fernandes,
	Daniel Axtens, Arvind Sankar, Andy Shevchenko,
	Alexandru Ardelean, Yury Norov, x86, H . Peter Anvin,
	Ard Biesheuvel, Paul E . McKenney, Daniel Kiper, Bruce Ashfield,
	Marco Elver, Vamshi K Sthambamkadi, Andi Kleen, Linus Torvalds,
	Dávid Bolvanský,
	Eli Friedman, Nick Desaulniers

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-08-20  3:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-19 19:16 [PATCH v2 0/5] -ffreestanding/-fno-builtin-* patches Nick Desaulniers
2020-08-19 19:16 ` [PATCH v2 1/5] Makefile: add -fno-builtin-stpcpy Nick Desaulniers
2020-08-20  3:33   ` Nathan Chancellor
2020-08-19 19:16 ` [PATCH v2 2/5] Makefile: add -fno-builtin-bcmp Nick Desaulniers
2020-08-20  3:33   ` Nathan Chancellor
2020-08-19 19:16 ` [PATCH v2 3/5] Revert "lib/string.c: implement a basic bcmp" Nick Desaulniers
2020-08-20  3:34   ` Nathan Chancellor
2020-08-19 19:16 ` [PATCH v2 4/5] x86/boot: use -fno-builtin-bcmp Nick Desaulniers
2020-08-19 19:29   ` Arvind Sankar
2020-08-19 20:11     ` Nick Desaulniers
2020-08-19 19:16 ` [PATCH v2 5/5] x86: don't build CONFIG_X86_32 as -ffreestanding Nick Desaulniers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).