Re: Regression [Was: Boot hang with stack protector on x86_64]

James Morris
2008-02-24T22:55:05Z

On Sat, 23 Feb 2008, Ingo Molnar wrote:

>
> * Ingo Molnar <mingo@elte.hu> wrote:
>
> > could you try the fix below ontop of x86.git#testing, does it solve
> > your boot hang?
>
> find below another fix that is somewhat better as it does not affect the
> native kernel and !PARAVIRT.

This works.

>
> btw., this also explains why this bug wasnt reported sooner against
> x86.git#testing: people done normally use PARAVIRT on 64-bit yet.
> (there is no 64-bit host support)
>
> Ingo
>
> ---------------->
> Subject: x86: stackprotector & PARAVIRT fix
> From: Ingo Molnar <mingo@elte.hu>
> Date: Sat Feb 23 07:06:55 CET 2008
>
> on paravirt enabled 64-bit kernels the paravirt ops do function
> calls themselves - which is bad with the stackprotector - for
> example pda_init() loads 0 into %gs and then does MSR_GS_BASE
> write (which modifies gs.base) - but that MSR write is a function
> call on paravirt, which with stackprotector tries to read the
> stack canary from the PDA ... crashing the bootup.
>
> the solution was suggested by Arjan van de Ven: to exclude paravirt.c
> from stackprotector, too many lowlevel functionality is in it. It's
> not like we'll have paravirt functions with character arrays on
> their stack anyway...
>
> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> ---
> arch/x86/kernel/Makefile | 1 +
> 1 file changed, 1 insertion(+)
>
> Index: linux-x86.q/arch/x86/kernel/Makefile
> ===================================================================
> --- linux-x86.q.orig/arch/x86/kernel/Makefile
> +++ linux-x86.q/arch/x86/kernel/Makefile
> @@ -15,6 +15,7 @@ nostackp := $(call cc-option, -fno-stack
> CFLAGS_vsyscall_64.o := $(PROFILING) -g0 $(nostackp)
> CFLAGS_hpet.o := $(nostackp)
> CFLAGS_tsc_64.o := $(nostackp)
> +CFLAGS_paravirt.o := $(nostackp)
>
> obj-y := process_$(BITS).o signal_$(BITS).o entry_$(BITS).o
> obj-y += traps_$(BITS).o irq_$(BITS).o
>

--
James Morris
<jmorris@namei.org>