[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOd=Dza3UBfeUzs2RW6ko5fDr3jYeGQAYpJXqyEVns6DJHg@mail.gmail.com>
Date: Wed, 22 Apr 2020 11:55:50 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Borislav Petkov <bp@...en8.de>
Cc: Michael Matz <matz@...e.de>, Jakub Jelinek <jakub@...hat.com>,
Sergei Trofimovich <slyfox@...too.org>,
LKML <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
clang-built-linux <clang-built-linux@...glegroups.com>,
Kees Cook <keescook@...omium.org>
Subject: Re: [PATCH v2] x86: fix early boot crash on gcc-10
On Wed, Apr 22, 2020 at 3:23 AM Borislav Petkov <bp@...en8.de> wrote:
>
> Ok,
>
> let's try the simple and clean fix first. Nick, would that work on LLVM
> too?
>
> And I hope this will remain working and the compiler won't jump over an
> inline asm and go nuts.
>
> Thx.
>
> ---
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index 3b9bf8c7e29d..06d2e16bedbb 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -266,6 +266,13 @@ static void notrace start_secondary(void *unused)
>
> wmb();
> cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
> +
> + /*
> + * Prevent tail call to cpu_startup_entry() because the stack protector
> + * guard has been changed in the middle of this function and must not be
> + * checked before tail calling another function.
Can you add by whom? It's not clear to me which function call in
start_secondary modifies the stack protector guard.
Another question. Do we not want a stack protector at all in this
function? I'm not super familiar with how they work; do we not want
them at all, or simply not to check the guard?
But if we're not going to check it, I think
__attribute__((no_stack_protector)) applied to start_secondary might
be a more precise fix. Though the empty asm statement may be the most
portable at this time, and with a well specified comment, I can live
with it.
> + */
> + asm ("");
> }
>
> /**
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists