[PATCH] -mstack-protector-guard and friends (PR78875)

Segher Boessenkool segher@kernel.crashing.org
Tue Jan 17 21:08:00 GMT 2017

On Tue, Jan 17, 2017 at 05:43:54PM +0000, Segher Boessenkool wrote:
> Currently, on PowerPC, code compiled with -fstack-protector will load
> the canary from -0x7010(13) (for -m64) or from -0x7008(2) (for -m32)
> if GCC was compiled against GNU libc 2.4 or newer or some other libc
> that supports -fstack-protector, and from the global variable
> __stack_chk_guard otherwise.
> This does not work well for Linux and other OS kernels and similar.
> For such non-standard applications, this patch creates a few new
> command-line options.  The relevant new use cases are:
> -mstack-protector-guard=global
> Use the __stack_chk_guard variable, no matter how this GCC was
> configured.
> -mstack-protector-guard=tls
> Use the canary from TLS.  This will error out if this GCC was built
> with a C library that does not support it.
> -mstack-protector-guard=tls -mstack-protector-register=<reg>
> -mstack-protector-offset=<offset>
> Load the canary from offset <off> from base register <reg>.
> Bootstrap and test running.  Is this okay for trunk?

No problems found on powerpc64-linux {-m32,-m64}.


More information about the Gcc-patches mailing list