Re: [PATCH v2] x86: fix early boot crash on gcc-10

From: Nick Desaulniers
Date: Wed Apr 22 2020 - 17:05:29 EST


On Wed, Apr 22, 2020 at 12:21 PM Borislav Petkov <bp@xxxxxxxxx> wrote:
>
> On Wed, Apr 22, 2020 at 11:55:50AM -0700, Nick Desaulniers wrote:
> > Can you add by whom? It's not clear to me which function call in
> > start_secondary modifies the stack protector guard.
>
> How's that
>
> /*
> * Prevent tail call to cpu_startup_entry() because the stack protector
> * guard has been changed a couple of functions up, in

s/functions/statements/
or
s/functions/function calls/

Sorry to be pedantic and bikeshed a comment! *ducks*

With that you can add my:
Reviewed-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>


> * boot_init_stack_canary() and must not be checked before tail calling
> * another function.
> */
> asm ("");
>
> ?
>
> > 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?
>
> Not to check the guard. See the beginning of
> arch/x86/include/asm/stackprotector.h about how they work.
>
> > 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.
>
> No such attribute in gcc yet. But yes, this came up a bit upthread, you
> can go back in time for details. :)

Filed: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94722
(Maybe a link to that might be helpful in the comment, for future
travelers? But I don't feel strongly about that either way, and
trust+defer to your judgement).
--
Thanks,
~Nick Desaulniers