Skip to content

Commit d6a9fb8

Browse files
nathanchancekees
authored andcommitted
security: Restrict CONFIG_ZERO_CALL_USED_REGS to gcc or clang > 15.0.6
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: [email protected] # v5.15+ Signed-off-by: Nathan Chancellor <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f68022a commit d6a9fb8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

security/Kconfig.hardening

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ config INIT_ON_FREE_DEFAULT_ON
257257

258258
config CC_HAS_ZERO_CALL_USED_REGS
259259
def_bool $(cc-option,-fzero-call-used-regs=used-gpr)
260+
# https://github.com/ClangBuiltLinux/linux/issues/1766
261+
# https://github.com/llvm/llvm-project/issues/59242
262+
depends on !CC_IS_CLANG || CLANG_VERSION > 150006
260263

261264
config ZERO_CALL_USED_REGS
262265
bool "Enable register zeroing on function exit"

0 commit comments

Comments
 (0)