Bug 218703

Summary: KASAN: make compatible with USE_X86_SEG_SUPPORT
Product: Memory Management Reporter: Andrey Konovalov (andreyknvl)
Component: SanitizersAssignee: MM/Sanitizers virtual assignee (mm_sanitizers)
Status: RESOLVED CODE_FIX    
Severity: normal CC: kasan-dev
Priority: P3    
Hardware: All   
OS: Linux   
Kernel Version: Subsystem:
Regression: No Bisected commit-id:

Description Andrey Konovalov 2024-04-10 11:11:04 UTC
USE_X86_SEG_SUPPORT [1] (enabled by default) is incompatible with KASAN [2] due to a bug in the GCC instrumentation module [3].

While the bug is being fixed in GCC, USE_X86_SEG_SUPPORT is marked as "depends on !KASAN". Once the bug is resolved, we need something like CC_HAS_WORKING_NAMED_AS (defined to match GCC 13+ versions where the issue is fixed?) and make USE_X86_SEG_SUPPORT depend on that config instead.

I'm not sure what's the state of things with Clang, but USE_X86_SEG_SUPPORT is only supported with GCC right now.

KCSAN seems to suffer from the same issue [4].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1ca3683cc6d2c2ce4204df519c4e4730d037905a
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e29aad08b1da7772b362537be32335c0394e65fe
[3] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111736
[4] https://lore.kernel.org/all/CANpmjNOsZydmYVU-waN1BdA=2RH0fhjmZcjnaf4JiObA++1p2w@mail.gmail.com/