Skip to content

Commit a52f8a5

Browse files
committed
fortify: Explicitly disable Clang support
Clang has never correctly compiled the FORTIFY_SOURCE defenses due to a couple bugs: Eliding inlines with matching __builtin_* names https://bugs.llvm.org/show_bug.cgi?id=50322 Incorrect __builtin_constant_p() of some globals https://bugs.llvm.org/show_bug.cgi?id=41459 In the process of making improvements to the FORTIFY_SOURCE defenses, the first (silent) bug (coincidentally) becomes worked around, but exposes the latter which breaks the build. As such, Clang must not be used with CONFIG_FORTIFY_SOURCE until at least latter bug is fixed (in Clang 13), and the fortify routines have been rearranged. Update the Kconfig to reflect the reality of the current situation. Signed-off-by: Kees Cook <[email protected]> Acked-by: Nick Desaulniers <[email protected]> Link: https://lore.kernel.org/lkml/CAKwvOd=A+ueGV2ihdy5GtgR2fQbcXjjAtVxv3=cPjffpebZB7A@mail.gmail.com
1 parent c430f60 commit a52f8a5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

security/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ config HARDENED_USERCOPY_PAGESPAN
191191
config FORTIFY_SOURCE
192192
bool "Harden common str/mem functions against buffer overflows"
193193
depends on ARCH_HAS_FORTIFY_SOURCE
194+
# https://bugs.llvm.org/show_bug.cgi?id=50322
195+
# https://bugs.llvm.org/show_bug.cgi?id=41459
196+
depends on !CC_IS_CLANG
194197
help
195198
Detect overflows of buffers in common string and memory functions
196199
where the compiler can determine and validate the buffer sizes.

0 commit comments

Comments
 (0)