This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [hurd,commited]: Fix static initialization with -fstack-protector-strong
- From: Nick Alcock <nix at esperi dot org dot uk>
- To: Samuel Thibault <samuel dot thibault at ens-lyon dot org>
- Cc: libc-alpha at sourceware dot org
- Date: Fri, 15 Sep 2017 17:38:38 +0100
- Subject: Re: [hurd,commited]: Fix static initialization with -fstack-protector-strong
- Authentication-results: sourceware.org; auth=none
- References: <20170827203205.7rymov2jglbcibbz@var.youpi.perso.aquilenet.fr>
On 27 Aug 2017, Samuel Thibault outgrape:
> When linked statically, TLS initialization is not achieved before
> mach_init and alike, so ssp accesses to tcbhead's stack_guard would
> crash. We can just avoid using ssp in the few functions needed before
> TLS is set up.
Oh blast I forgot all about Hurd didn't I.
Sorry.
> diff --git a/hurd/Makefile b/hurd/Makefile
> index 9205822b24..b44b9b80c6 100644
> --- a/hurd/Makefile
> +++ b/hurd/Makefile
> @@ -81,6 +81,10 @@ $(inlines:%=$(objpfx)%.c): $(objpfx)%-inlines.c: %.h
> echo '#include "$<"') > $@-new
> mv -f $@-new $@
> generated += $(inlines:=.c)
> +
> +# Avoid ssp before TLS is initialized.
> +CFLAGS-hurdstartup.o = $(no-stack-protector)
> +CFLAGS-RPC_exec_startup_get_info.o = $(no-stack-protector)
This certainly looks like the right sort of thing to be doing, though I
don't have anything I can test it on right now.
-fstack-protector-all might well comb out some more cases.
--
NULL && (void)