Skip to content

Commit 640bb22

Browse files
ubizjakgregkh
authored andcommitted
x86/percpu: Disable named address spaces for UBSAN_BOOL with KASAN for GCC < 14.2
[ Upstream commit b676246 ] GCC < 14.2 does not correctly propagate address space qualifiers with -fsanitize=bool,enum. Together with address sanitizer then causes that load to be sanitized. Disable named address spaces for GCC < 14.2 when both, UBSAN_BOOL and KASAN are enabled. Reported-by: Matt Fleming <matt@readmodwrite.com> Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20250227140715.2276353-1-ubizjak@gmail.com Closes: https://lore.kernel.org/lkml/20241213190119.3449103-1-matt@readmodwrite.com/ Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 837f5cb commit 640bb22

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

arch/x86/Kconfig

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2434,18 +2434,20 @@ config CC_HAS_NAMED_AS
24342434
def_bool $(success,echo 'int __seg_fs fs; int __seg_gs gs;' | $(CC) -x c - -S -o /dev/null)
24352435
depends on CC_IS_GCC
24362436

2437+
#
2438+
# -fsanitize=kernel-address (KASAN) and -fsanitize=thread (KCSAN)
2439+
# are incompatible with named address spaces with GCC < 13.3
2440+
# (see GCC PR sanitizer/111736 and also PR sanitizer/115172).
2441+
#
2442+
24372443
config CC_HAS_NAMED_AS_FIXED_SANITIZERS
2438-
def_bool CC_IS_GCC && GCC_VERSION >= 130300
2444+
def_bool y
2445+
depends on !(KASAN || KCSAN) || GCC_VERSION >= 130300
2446+
depends on !(UBSAN_BOOL && KASAN) || GCC_VERSION >= 140200
24392447

24402448
config USE_X86_SEG_SUPPORT
2441-
def_bool y
2442-
depends on CC_HAS_NAMED_AS
2443-
#
2444-
# -fsanitize=kernel-address (KASAN) and -fsanitize=thread
2445-
# (KCSAN) are incompatible with named address spaces with
2446-
# GCC < 13.3 - see GCC PR sanitizer/111736.
2447-
#
2448-
depends on !(KASAN || KCSAN) || CC_HAS_NAMED_AS_FIXED_SANITIZERS
2449+
def_bool CC_HAS_NAMED_AS
2450+
depends on CC_HAS_NAMED_AS_FIXED_SANITIZERS
24492451

24502452
config CC_HAS_SLS
24512453
def_bool $(cc-option,-mharden-sls=all)

0 commit comments

Comments
 (0)