On Sat, 2023-03-11 at 10:54 +0200, Thomas Gleixner wrote: > On Wed, Mar 08 2023 at 17:13, Usama Arif wrote: > > > > +/* Bringup step one: Send INIT/SIPI to the target AP */ > > +static int native_cpu_kick(unsigned int cpu) > > +{ > > + return do_cpu_up(cpu, idle_thread_get(cpu)); > > This idle_thread_get() is not sufficient. bringup_cpu() does: > > struct task_struct *idle = idle_thread_get(cpu); > > /* > * Reset stale stack state from the last time this CPU was online. > */ > scs_task_reset(idle); > kasan_unpoison_task_stack(idle); > > But with this new model neither the shadow stack gets reset nor the > kasan unpoisoning happens _before_ the to be kicked CPU starts > executing. > > That needs a new function which does the get() and the above. Ah, good catch. Those were added after we started on this journey :) I think I'll do it with a 'bool unpoison' argument to idle_thread_get(). Or just make it unconditional; they're idempotent anyway and cheap enough? Kind of weird to be doing it from finish_cpu() though, so I'll probably stick with the argument. ....*types*.... Erm, there are circumstances (!CONFIG_GENERIC_SMP_IDLE_THREAD) when idle_thread_get() just unconditionally returns NULL. At first glance, it doesn't look like scs_task_reset() copes with being passed a NULL. Am I missing something? $ grep -c GENERIC_SMP_IDLE_THREAD `grep -l SMP arch/*/Kconfig` arch/alpha/Kconfig:1 arch/arc/Kconfig:1 arch/arm64/Kconfig:1 arch/arm/Kconfig:1 arch/csky/Kconfig:1 arch/hexagon/Kconfig:1 arch/ia64/Kconfig:1 arch/loongarch/Kconfig:1 arch/mips/Kconfig:1 arch/openrisc/Kconfig:1 arch/parisc/Kconfig:1 arch/powerpc/Kconfig:1 arch/riscv/Kconfig:1 arch/s390/Kconfig:1 arch/sh/Kconfig:1 arch/sparc/Kconfig:1 arch/um/Kconfig:0 arch/x86/Kconfig:1 arch/xtensa/Kconfig:1 Maybe just nobody but UM cares?
Attachment:
smime.p7s
Description: S/MIME cryptographic signature