linux/arch/loongarch
Tiezhu Yang 78dd793ae6 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:27 -05:00
..
boot LoongArch: dts: loongson-2k2000: Add default interrupt controller address cells 2026-01-23 11:21:32 +01:00
configs LoongArch changes for v6.18 2025-10-06 12:18:56 -07:00
crypto loongarch/crc32: expose CRC32 functions through lib 2024-12-01 17:23:01 -08:00
include LoongArch: Make cpumask_of_node() robust against NUMA_NO_NODE 2026-03-04 07:21:26 -05:00
kernel LoongArch: Guard percpu handler under !CONFIG_PREEMPT_RT 2026-03-04 07:21:26 -05:00
kvm LoongArch: KVM: Fix kvm_device leak in kvm_pch_pic_destroy() 2026-01-23 11:21:32 +01:00
lib lib/crc: loongarch: Migrate optimized CRC code into lib/crc/ 2025-06-30 09:31:57 -07:00
mm LoongArch: Disable instrumentation for setup_ptwalker() 2026-03-04 07:21:27 -05:00
net kallsyms/bpf: rename __bpf_address_lookup() to bpf_address_lookup() 2026-02-26 14:59:17 -08:00
pci LoongArch: Add new PCI ID for pci_fixup_vgadev() 2026-01-08 10:17:05 +01:00
power LoongArch: Save and restore CSR.CNTC for hibernation 2025-05-14 22:17:52 +08:00
vdso LoongArch: vDSO: Remove -nostdlib complier flag 2025-08-05 19:00:22 +08:00
Kbuild LoongArch: Migrate to the generic rule for built-in DTB 2025-01-25 18:51:33 +08:00
Kconfig LoongArch changes for v6.18 2025-10-06 12:18:56 -07:00
Kconfig.debug LoongArch: Only allow OBJTOOL & ORC unwinder if toolchain supports -mthin-add-sub 2024-06-21 10:18:40 +08:00
Makefile rust: kbuild: support -Cjump-tables=n for Rust 1.93.0 2025-11-04 19:11:39 +01:00