Le 11/01/2017 à 23:54, Segher Boessenkool a écrit :
On Tue, Jan 10, 2017 at 07:26:15AM +0100, Christophe LEROY wrote:
Maybe ppc32 is not supposed to be built with CC_STACKPROTECTOR ?
Indeed, the latest versions of GCC don't use anymore the global variable
__stack_chk_guard as canary value, but a value stored at -0x7008(r2).
This is not compatible with the current implementation of the kernel
with uses r2 as a pointeur to current task struct.
So until we fix it, I don't think CC_STACKPROTECTOR is usable on PPC
with modern versions of GCC.
I still wonder what changed. Nothing relevant has changed for ten years
or whatever as far as I see; unless it is just the -fstack-protector-strong
that makes it fail now. Curious.
Yes, looks like it was changed from global to TLS in 2005 on powerpc.
Indeed when I implemented STACKPROTECTOR in Kernel on ppc I
copied/pasted it from ARM which is (still?) using the global
__stack_chk_guard, and at first it worked quite well on my powerpc.
x86 has the following option on GCC. Couldn't we have it on powerpc too ?
-mstack-protector-guard=guard
Generate stack protection code using canary at
guard. Supported locations are ‘ global ’ for global canary or ‘ tls
’ for per-thread canary in the TLS block (the default). This option
has effect only when ‘-fstack-protector’ or ‘-fstack-protector-all’
is specified.
Christophe