linux/arch/loongarch
Tiezhu Yang e6e65be075 LoongArch: Disable instrumentation for setup_ptwalker()
[ Upstream commit 7cb37af61f ]

According to Documentation/dev-tools/kasan.rst, software KASAN modes use
compiler instrumentation to insert validity checks. Such instrumentation
might be incompatible with some parts of the kernel, and therefore needs
to be disabled, just use the attribute __no_sanitize_address to disable
instrumentation for the low level function setup_ptwalker().

Otherwise bringing up the secondary CPUs failed when CONFIG_KASAN is set
(especially when PTW is enabled), here are the call chains:

    smpboot_entry()
      start_secondary()
        cpu_probe()
          per_cpu_trap_init()
            tlb_init()
              setup_tlb_handler()
                setup_ptwalker()

The reason is the PGD registers are configured in setup_ptwalker(), but
KASAN instrumentation may cause TLB exceptions before that.

Cc: stable@vger.kernel.org
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-03-04 07:21:55 -05:00
..
boot LoongArch: dts: loongson-2k2000: Add default interrupt controller address cells 2026-01-23 11:18:48 +01:00
configs mm: z3fold: deprecate CONFIG_Z3FOLD 2024-09-17 01:07:00 -07:00
crypto move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
include LoongArch: Make cpumask_of_node() robust against NUMA_NO_NODE 2026-03-04 07:21:55 -05:00
kernel LoongArch: Guard percpu handler under !CONFIG_PREEMPT_RT 2026-03-04 07:21:55 -05:00
kvm LoongArch: KVM: Add delay until timer interrupt injected 2025-11-24 10:35:58 +01:00
lib LoongArch: csum: Fix OoB access in IP checksum code for negative lengths 2025-02-21 14:01:17 +01:00
mm LoongArch: Disable instrumentation for setup_ptwalker() 2026-03-04 07:21:55 -05:00
net LoongArch: BPF: Sign extend kfunc call arguments 2026-01-08 10:14:51 +01:00
pci LoongArch: Add new PCI ID for pci_fixup_vgadev() 2026-01-08 10:14:46 +01:00
power LoongArch: Save and restore CSR.CNTC for hibernation 2025-05-22 14:29:44 +02:00
vdso LoongArch: vDSO: Remove -nostdlib complier flag 2025-09-09 18:58:05 +02:00
Kbuild LoongArch: Allow device trees be built into the kernel 2024-01-17 12:43:00 +08:00
Kconfig fgraph: Replace fgraph_ret_regs with ftrace_regs 2026-03-04 07:19:36 -05:00
Kconfig.debug LoongArch: Only allow OBJTOOL & ORC unwinder if toolchain supports -mthin-add-sub 2024-06-21 10:18:40 +08:00
Makefile LoongArch: Add cflag -fno-isolate-erroneous-paths-dereference 2025-10-19 16:33:39 +02:00