The patch titled Subject: arm64: kasan: clear stale stack poison has been added to the -mm tree. Its filename is arm64-kasan-clear-stale-stack-poison.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/arm64-kasan-clear-stale-stack-poison.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/arm64-kasan-clear-stale-stack-poison.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Mark Rutland <mark.rutland@xxxxxxx> Subject: arm64: kasan: clear stale stack poison Functions which the compiler has instrumented for KASAN place poison on the stack shadow upon entry and remove this poison prior to returning. In the case of cpuidle, CPUs exit the kernel a number of levels deep in C code. Any instrumented functions on this critical path will leave portions of the stack shadow poisoned. If CPUs lose context and return to the kernel via a cold path, we restore a prior context saved in __cpu_suspend_enter are forgotten, and we never remove the poison they placed in the stack shadow area by functions calls between this and the actual exit of the kernel. Thus, (depending on stackframe layout) subsequent calls to instrumented functions may hit this stale poison, resulting in (spurious) KASAN splats to the console. To avoid this, clear any stale poison from the idle thread for a CPU prior to bringing a CPU online. Signed-off-by: Mark Rutland <mark.rutland@xxxxxxx> Acked-by: Catalin Marinas <catalin.marinas@xxxxxxx> Reviewed-by: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@xxxxxxx> Cc: Alexander Potapenko <glider@xxxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Will Deacon <will.deacon@xxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/arm64/kernel/sleep.S | 4 ++++ 1 file changed, 4 insertions(+) diff -puN arch/arm64/kernel/sleep.S~arm64-kasan-clear-stale-stack-poison arch/arm64/kernel/sleep.S --- a/arch/arm64/kernel/sleep.S~arm64-kasan-clear-stale-stack-poison +++ a/arch/arm64/kernel/sleep.S @@ -145,6 +145,10 @@ ENTRY(cpu_resume_mmu) ENDPROC(cpu_resume_mmu) .popsection cpu_resume_after_mmu: +#ifdef CONFIG_KASAN + mov x0, sp + bl kasan_unpoison_remaining_stack +#endif mov x0, #0 // return zero on success ldp x19, x20, [sp, #16] ldp x21, x22, [sp, #32] _ Patches currently in -mm which might be from mark.rutland@xxxxxxx are kasan-add-functions-to-clear-stack-poison.patch sched-kasan-remove-stale-kasan-poison-after-hotplug.patch arm64-kasan-clear-stale-stack-poison.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html