[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8f4c4a62-d912-0cd9-3462-8df20a868834@virtuozzo.com>
Date: Thu, 1 Dec 2016 12:05:34 +0300
From: Andrey Ryabinin <aryabinin@...tuozzo.com>
To: Josh Poimboeuf <jpoimboe@...hat.com>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Len Brown <len.brown@...el.com>, Pavel Machek <pavel@....cz>,
<linux-pm@...r.kernel.org>
CC: <linux-kernel@...r.kernel.org>, <peterz@...radead.org>,
<mingo@...nel.org>, <luto@...capital.net>,
Scott Bauer <scott.bauer@...el.com>, <x86@...nel.org>,
Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
<kasan-dev@...glegroups.com>
Subject: Re: [PATCH] x86/suspend: fix false positive KASAN warning on
suspend/resume
On 12/01/2016 02:10 AM, Josh Poimboeuf wrote:
> Resuming from a suspend operation is showing a KASAN false positive
> warning:
>
> KASAN instrumentation poisons the stack when entering a function and
> unpoisons it when exiting the function. However, in the suspend path,
> some functions never return, so their stack never gets unpoisoned,
> resulting in stale KASAN shadow data which can cause false positive
> warnings like the one above.
>
> Reported-by: Scott Bauer <scott.bauer@...el.com>
> Tested-by: Scott Bauer <scott.bauer@...el.com>
> Signed-off-by: Josh Poimboeuf <jpoimboe@...hat.com>
> ---
> arch/x86/kernel/acpi/sleep.c | 3 +++
> include/linux/kasan.h | 7 +++++++
> 2 files changed, 10 insertions(+)
>
> diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
> index 4858733..62bd046 100644
> --- a/arch/x86/kernel/acpi/sleep.c
> +++ b/arch/x86/kernel/acpi/sleep.c
> @@ -115,6 +115,9 @@ int x86_acpi_suspend_lowlevel(void)
> pause_graph_tracing();
> do_suspend_lowlevel();
> unpause_graph_tracing();
> +
> + kasan_unpoison_stack_below_sp();
> +
I think this might be too late. We may hit stale poison in the first C function called
after resume (restore_processor_state()). Thus the shadow must be unpoisoned prior such call,
i.e. somewhere in do_suspend_lowlevel() after .Lresume_point.
Powered by blists - more mailing lists