Skip to content

Commit a989bf1

Browse files
ubizjakjfvogel
authored andcommitted
x86/percpu: Disable named address spaces for UBSAN_BOOL with KASAN for GCC < 14.2
[ Upstream commit b6762467a09ba8838c499e4f36561e82fc608ed1 ] 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 <[email protected]> Signed-off-by: Uros Bizjak <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Closes: https://lore.kernel.org/lkml/[email protected]/ Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit 640bb225215810cf883f1bbd30d1d75f1b77d422) Signed-off-by: Jack Vogel <[email protected]>
1 parent 8211ca6 commit a989bf1

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
@@ -2445,18 +2445,20 @@ config CC_HAS_NAMED_AS
24452445
def_bool $(success,echo 'int __seg_fs fs; int __seg_gs gs;' | $(CC) -x c - -S -o /dev/null)
24462446
depends on CC_IS_GCC
24472447

2448+
#
2449+
# -fsanitize=kernel-address (KASAN) and -fsanitize=thread (KCSAN)
2450+
# are incompatible with named address spaces with GCC < 13.3
2451+
# (see GCC PR sanitizer/111736 and also PR sanitizer/115172).
2452+
#
2453+
24482454
config CC_HAS_NAMED_AS_FIXED_SANITIZERS
2449-
def_bool CC_IS_GCC && GCC_VERSION >= 130300
2455+
def_bool y
2456+
depends on !(KASAN || KCSAN) || GCC_VERSION >= 130300
2457+
depends on !(UBSAN_BOOL && KASAN) || GCC_VERSION >= 140200
24502458

24512459
config USE_X86_SEG_SUPPORT
2452-
def_bool y
2453-
depends on CC_HAS_NAMED_AS
2454-
#
2455-
# -fsanitize=kernel-address (KASAN) and -fsanitize=thread
2456-
# (KCSAN) are incompatible with named address spaces with
2457-
# GCC < 13.3 - see GCC PR sanitizer/111736.
2458-
#
2459-
depends on !(KASAN || KCSAN) || CC_HAS_NAMED_AS_FIXED_SANITIZERS
2460+
def_bool CC_HAS_NAMED_AS
2461+
depends on CC_HAS_NAMED_AS_FIXED_SANITIZERS
24602462

24612463
config CC_HAS_SLS
24622464
def_bool $(cc-option,-mharden-sls=all)

0 commit comments

Comments
 (0)