Thread (6 messages) 6 messages, 3 authors, 2021-11-15

Re: KASAN + CPU soft-hotplug = stack-out-of-bounds at cpuinfo_store_cpu

From: Mark Rutland <mark.rutland@arm.com>
Date: 2021-11-15 13:52:09
Also in: lkml

On Mon, Nov 15, 2021 at 10:44:11AM +0000, Mark Rutland wrote:
Hi,

On Fri, Nov 12, 2021 at 11:50:16PM -0500, Qian Cai wrote:
quoted
FYI, running CPU soft-hotplug with KASAN on arm64 defconfig will
always trigger a stack-out-of-bounds below. I am not right sure where
exactly KASAN pointed at, so I am just doing the brute-force
bisect. The progress so far:
From below it looks like this is on linux-next; I can reproduce this on
v5.16-rc1 using your config, when hotplugging CPU0 back in.

We used to have issues with stale poison being left on the stack across a
hotplug, and we fixed that with commit:

  e1b77c92981a5222 ("sched/kasan: remove stale KASAN poison after hotplug")

... but it looks like we no longer call init_idle() for each hotplug since commit:

  f1a0a376ca0c4ef1 ("sched/core: Initialize the idle task with preemption disabled")

... and so don't get the kasan_unpoison_task_stack() call which we want when
bringing up a CPU, which we used to get by way of idle_thread_get() calling init_idle().

Adding a call to kasan_unpoison_task_stack(idle) within bringup_cpu() gets rid
of that, and I reckon we want that explciitly *somewhere* on the CPU bringup
path.
FWIW I sent that out as a patch:

https://lore.kernel.org/linux-arm-kernel/20211115113310.35693-1-mark.rutland@arm.com/ (local)

Thanks,
Mark.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help