This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] S/390: stack_protect_set/test
On Mon, Jul 11, 2005 at 05:28:02PM +0200, Andreas Krebbel wrote:
> I've merged my patch introducing the stack_protect* patterns for S/390 with
> your tls canary value changes.
> On s390x I've built a glibc from cvs head and verified that the tls stuff works.
>
> But I'm not sure why putting the canary value in the tcb is an advantage?! At
> least performance is not an issue here because the S/390 way of addressing a tls
> value is slower compared to a GOT reference.
> Or is it meant to be security improvement by making threads using different
> canary values?
How much slower?
ear %r12,%a0
...
mvc 116(4,%r15),20(%r12)
against a memory load (assuming %r12 setup is necessary anyway, otherwise
also the GOT setup sequence) and similar mvc.
The TLS canary has at least two reasons, speed and avoiding COPY relocs.
If __stack_chk_guard ends up living in program's .bss due to COPY
relocation, it is far easier to overwrite it there by overflowing some
.data section buffer preceeding it.
If TLS canary on s390{,x} is really much slower than __stack_chk_guard
and we decide to use __stack_chk_guard there rather than the TLS canary,
we need to do this ASAP (revert glibc changes for s390{,x}, so that
__stack_chk_guard is exported on that arch).
Jakub