kasan: fix wrong kasan report when resume [1/1]
authorTao Zeng <tao.zeng@amlogic.com>
Wed, 24 Apr 2019 08:10:03 +0000 (16:10 +0800)
committerTao Zeng <tao.zeng@amlogic.com>
Sun, 28 Apr 2019 02:08:31 +0000 (19:08 -0700)
commitf2d3db7da4a4594042c76318f907fb4e3bb0b9ff
tree515b69c195dbdee4eba5afd8e53583df1e0987c9
parent27cbaca18d879e7bf4d32283487213398367b1ac
kasan: fix wrong kasan report when resume [1/1]

PD#SWPL-7676

Problem:
If we open kasan on 32bit kernel, after resume we usually will
get a stack-out-of-bounds KASAN error report. But infact that's
a fake report. Because On arm architecture, cpu suspend/resume
routine is done in function call path:
    cpu_suspend -> psci_cpu_suspend -> __invoke_psci_fn_smc
during this call path, some parts of stack will be marked as
shadow memory. But when cpu resume from smc call, it directly
return to point which saved in cpu_suspend and call resume
procedure. Which do not comeback as a reverse return path:
    __invoke_psci_fn_smc -> psci_cpu_suspend -> cpu_suspend
So some residual shadow memory may affect KASAN report when
cpu is calling resume hooks.

Solution:
We just need to clear all shadow in stack for this case.

Verify:
p212

Change-Id: Ic6c877212240d03902b11184e54ac363455e0094
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
arch/arm/kernel/sleep.S
arch/arm/mm/kasan_init.c