]> Git Repo - linux.git/commit - security/Kconfig
fortify: Add Clang support
authorKees Cook <[email protected]>
Tue, 8 Feb 2022 22:53:50 +0000 (14:53 -0800)
committerKees Cook <[email protected]>
Mon, 14 Feb 2022 00:50:07 +0000 (16:50 -0800)
commit281d0c962752fb40866dd8d4cade68656f34bd1f
tree80e7f2219375ddbf042f9dab52a6e5dea45bcff5
parent67ebc3ab446230c77fe3b545a9d8a11cac1cfb6e
fortify: Add Clang support

Enable FORTIFY_SOURCE support for Clang:

Use the new __pass_object_size and __overloadable attributes so that
Clang will have appropriate visibility into argument sizes such that
__builtin_object_size(p, 1) will behave correctly. Additional details
available here:
    https://github.com/llvm/llvm-project/issues/53516
    https://github.com/ClangBuiltLinux/linux/issues/1401

A bug with __builtin_constant_p() of globally defined variables was
fixed in Clang 13 (and backported to 12.0.1), so FORTIFY support must
depend on that version or later. Additional details here:
    https://bugs.llvm.org/show_bug.cgi?id=41459
    commit a52f8a59aef4 ("fortify: Explicitly disable Clang support")

A bug with Clang's -mregparm=3 and -m32 makes some builtins unusable,
so removing -ffreestanding (to gain the needed libcall optimizations
with Clang) cannot be done. Without the libcall optimizations, Clang
cannot provide appropriate FORTIFY coverage, so it must be disabled
for CONFIG_X86_32. Additional details here;
    https://github.com/llvm/llvm-project/issues/53645

Cc: Miguel Ojeda <[email protected]>
Cc: Nick Desaulniers <[email protected]>
Cc: Nathan Chancellor <[email protected]>
Cc: George Burgess IV <[email protected]>
Cc: [email protected]
Signed-off-by: Kees Cook <[email protected]>
Reviewed-by: Nick Desaulniers <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
include/linux/fortify-string.h
security/Kconfig
This page took 0.077613 seconds and 4 git commands to generate.