]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
fortify: Explicitly disable Clang support
authorKees Cook <keescook@chromium.org>
Thu, 13 May 2021 04:51:10 +0000 (21:51 -0700)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 4 Jan 2022 08:48:41 +0000 (09:48 +0100)
BugLink: https://bugs.launchpad.net/bugs/1951820
commit a52f8a59aef46b59753e583bf4b28fccb069ce64 upstream.

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 <keescook@chromium.org>
Acked-by: Nick Desaulniers <ndesaulniers@google.com>
Link: https://lore.kernel.org/lkml/CAKwvOd=A+ueGV2ihdy5GtgR2fQbcXjjAtVxv3=cPjffpebZB7A@mail.gmail.com
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
security/Kconfig

index 7ca1a9b09305e970802d695aefd726f7a401d925..34b4a9007a0948ffa9289fba8345e2f1fbcdfca5 100644 (file)
@@ -200,6 +200,9 @@ config HARDENED_USERCOPY_PAGESPAN
 config FORTIFY_SOURCE
        bool "Harden common str/mem functions against buffer overflows"
        depends on ARCH_HAS_FORTIFY_SOURCE
+       # https://bugs.llvm.org/show_bug.cgi?id=50322
+       # https://bugs.llvm.org/show_bug.cgi?id=41459
+       depends on !CC_IS_CLANG
        help
          Detect overflows of buffers in common string and memory functions
          where the compiler can determine and validate the buffer sizes.