summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorNathan Chancellor <nathan@kernel.org>2022-12-14 16:26:03 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-12-31 13:14:46 +0100
commit8a4236456a3a402f6bb92aa7b75e7a3b4ef7a72c (patch)
tree492dd92c616353227300d6411ebd2c1671334978 /security
parent1cabce56626a61f4f02452cba61ad4332a4b73f8 (diff)
downloadlinux-8a4236456a3a402f6bb92aa7b75e7a3b4ef7a72c.tar.gz
linux-8a4236456a3a402f6bb92aa7b75e7a3b4ef7a72c.tar.bz2
linux-8a4236456a3a402f6bb92aa7b75e7a3b4ef7a72c.zip
security: Restrict CONFIG_ZERO_CALL_USED_REGS to gcc or clang > 15.0.6
commit d6a9fb87e9d18f3394a9845546bbe868efdccfd2 upstream. A bad bug in clang's implementation of -fzero-call-used-regs can result in NULL pointer dereferences (see the links above the check for more information). Restrict CONFIG_CC_HAS_ZERO_CALL_USED_REGS to either a supported GCC version or a clang newer than 15.0.6, which will catch both a theoretical 15.0.7 and the upcoming 16.0.0, which will both have the bug fixed. Cc: stable@vger.kernel.org # v5.15+ Signed-off-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20221214232602.4118147-1-nathan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'security')
-rw-r--r--security/Kconfig.hardening3
1 files changed, 3 insertions, 0 deletions
diff --git a/security/Kconfig.hardening b/security/Kconfig.hardening
index 942ed8de36d3..2e509e32cf75 100644
--- a/security/Kconfig.hardening
+++ b/security/Kconfig.hardening
@@ -240,6 +240,9 @@ config INIT_ON_FREE_DEFAULT_ON
config CC_HAS_ZERO_CALL_USED_REGS
def_bool $(cc-option,-fzero-call-used-regs=used-gpr)
+ # https://github.com/ClangBuiltLinux/linux/issues/1766
+ # https://github.com/llvm/llvm-project/issues/59242
+ depends on !CC_IS_CLANG || CLANG_VERSION > 150006
config ZERO_CALL_USED_REGS
bool "Enable register zeroing on function exit"