Skip to content

Commit d70da12

Browse files
committed
hardening: Enable i386 FORTIFY_SOURCE on Clang 16+
The i386 regparm bug exposed with FORTIFY_SOURCE with Clang was fixed in Clang 16[1]. Link: llvm/llvm-project@c167c0a [1] Reviewed-by: Nathan Chancellor <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
1 parent 16cb16e commit d70da12

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

arch/x86/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ ifeq ($(CONFIG_X86_32),y)
137137
include $(srctree)/arch/x86/Makefile_32.cpu
138138
KBUILD_CFLAGS += $(cflags-y)
139139

140-
ifeq ($(CONFIG_CC_IS_CLANG),y)
140+
ifneq ($(call clang-min-version, 160000),y)
141141
# https://github.com/llvm/llvm-project/issues/53645
142142
KBUILD_CFLAGS += -ffreestanding
143143
endif

security/Kconfig.hardening

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ config FORTIFY_SOURCE
286286
bool "Harden common str/mem functions against buffer overflows"
287287
depends on ARCH_HAS_FORTIFY_SOURCE
288288
# https://github.com/llvm/llvm-project/issues/53645
289-
depends on !CC_IS_CLANG || !X86_32
289+
depends on !X86_32 || !CC_IS_CLANG || CLANG_VERSION >= 160000
290290
help
291291
Detect overflows of buffers in common string and memory functions
292292
where the compiler can determine and validate the buffer sizes.

0 commit comments

Comments
 (0)