Re: [linus:master] [x86/percpu] ca42563486: BUG:unable_to_handle_page_fault_for_address

From: Uros Bizjak
Date: Mon Mar 25 2024 - 16:43:39 EST


On Mon, Mar 25, 2024 at 9:50 AM kernel test robot <oliver.sang@xxxxxxxxx> wrote:
>
>
> hi, Uros Bizjak,
>
> we reported an early crash issue for this commit last Oct.
> https://lore.kernel.org/all/202310071301.a5113890-oliver.sang@xxxxxxxxx/
>
> as you mentioned at that time
> "It is KASAN that is not compatible with named address spaces [1]."
>
> now we noticed the commit is merged into mainline, and we observed a different
> issue related with kcsan_setup_watchpoint. below detail report FYI.
>
> [1] https://lore.kernel.org/lkml/CAHk-=wi6U-O1wdPOESuCE6QO2OaPu0hEzaig0uDOU4L5CREhug@xxxxxxxxxxxxxx/
>

Yes, it is the same issue, but with KCSAN.

> Hello,
>
> kernel test robot noticed "BUG:unable_to_handle_page_fault_for_address" on:
>
> commit: ca4256348660cb2162668ec3d13d1f921d05374a ("x86/percpu: Use C for percpu read/write accessors")
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master
>
> [test failed on linus/master b3603fcb79b1036acae10602bffc4855a4b9af80]
> [test failed on linux-next/master 226d3c72fcde130a99d760895ebdd20e78e02cb5]
>
> in testcase: boot
>
> compiler: gcc-12
> test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G

We already have the candidate fix for GCC [1], the fix will be in gcc-13.3+.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111736

Please find attached an emergency patch for mainline that disables
named address spaces when KCSAN is enabled. I'll post a formal patch
submission in a moment. The named AS will be re-enabled with KCSAN
with a patch via -tip tree.

Thanks,
Uros.
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 39886bab943a..4fff6ed46e90 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2439,6 +2439,8 @@ config USE_X86_SEG_SUPPORT
# with named address spaces - see GCC PR sanitizer/111736.
#
depends on !KASAN
+ # -fsanitize=thread (KCSAN) is also incompatible.
+ depends on !KCSAN

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