Skip to content

Commit e29aad0

Browse files
ubizjakIngo Molnar
authored andcommitted
x86/percpu: Disable named address spaces for KASAN
-fsanitize=kernel-address (KASAN) is at the moment incompatible with named address spaces - see GCC PR sanitizer/111736: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111736 GCC is doing a KASAN check on a percpu address which it shouldn't do, and didn't used to do because we did the access using inline asm. But now that GCC does the accesses as normal (albeit special address space) memory accesses, the KASAN code triggers on them too, and it all goes to hell in a handbasket very quickly. Those percpu accessor functions need to disable any KASAN checking or other sanitizer checking. Not on the percpu address, because that's not a "real" address, it's obviously just the offset from the segment register. And GCC should probably not have generated such code in the first place, so arguably this is a bug with -fsanitize=kernel-address. The patch also removes a stale dependency on CONFIG_SMP. Reported-by: kernel test robot <oliver.sang@intel.com> Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Link: https://lore.kernel.org/r/20231009151409.53656-1-ubizjak@gmail.com Closes: https://lore.kernel.org/oe-lkp/202310071301.a5113890-oliver.sang@intel.com
1 parent ca42563 commit e29aad0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

arch/x86/Kconfig

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2393,7 +2393,12 @@ config CC_HAS_NAMED_AS
23932393

23942394
config USE_X86_SEG_SUPPORT
23952395
def_bool y
2396-
depends on CC_HAS_NAMED_AS && SMP
2396+
depends on CC_HAS_NAMED_AS
2397+
#
2398+
# -fsanitize=kernel-address (KASAN) is at the moment incompatible
2399+
# with named address spaces - see GCC PR sanitizer/111736.
2400+
#
2401+
depends on !KASAN
23972402

23982403
config CC_HAS_SLS
23992404
def_bool $(cc-option,-mharden-sls=all)

0 commit comments

Comments
 (0)