[PATCH v2] ARM: smp: set current pointer in assembly before jumping into C
Ard Biesheuvel
ardb at kernel.org
Sun Aug 2 02:34:22 PDT 2026
On Sat, 1 Aug 2026, at 18:35, Karl Mehltretter wrote:
> With CONFIG_KCOV_INSTRUMENT_ALL=y, secondary CPUs fail to come online
> on ARMv6K/ARMv7 SMP:
>
> CPU1: failed to boot: -38
>
> The compiler inserts a call to __sanitizer_cov_trace_pc() at the entry
> of secondary_start_kernel(), before set_current(task). The KCOV hook
> dereferences current while TPIDRURO is still uninitialized, causing a
> data abort before cpu_init() has installed the exception stacks. The
> secondary CPU consequently never completes startup.
>
> Initialize current in the secondary assembly handoff, as
> __mmap_switched already does for the boot CPU.
>
> With current set in assembly, the set_current() call in
> secondary_start_kernel() is redundant. Drop it together with the
> function and the task argument. The hotplug resuscitate path in
> arch_cpu_idle_dead() needs no hand-off either, as smp_ops.cpu_die()
> can only return if the CPU kept its register state, TPIDRURO included.
>
> Fixes: 50596b7559bf ("ARM: smp: Store current pointer in TPIDRURO
> register if available")
> Cc: stable at vger.kernel.org
> Assisted-by: Claude:claude-fable-5
> Signed-off-by: Karl Mehltretter <kmehltretter at gmail.com>
Reviewed-by: Ard Biesheuvel <ardb at kernel.org>
More information about the linux-arm-kernel
mailing list