aboutsummaryrefslogtreecommitdiff
path: root/elf/ifuncdep2.c
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2016-12-26 10:08:41 +0100
committerFlorian Weimer <fweimer@redhat.com>2016-12-26 10:08:41 +0100
commitde6591238b478bc86b8cf5af01a484114e399213 (patch)
tree2717c115fbc7518fcbe9348239ff536eb914d267 /elf/ifuncdep2.c
parent003a27e8195470f470f4d9384ca70d4e9fc8bd1b (diff)
downloadglibc-de6591238b478bc86b8cf5af01a484114e399213.tar
glibc-de6591238b478bc86b8cf5af01a484114e399213.tar.gz
glibc-de6591238b478bc86b8cf5af01a484114e399213.tar.bz2
glibc-de6591238b478bc86b8cf5af01a484114e399213.zip
Do not stack-protect ifunc resolvers [BZ #7065]
When dynamically linking, ifunc resolvers are called before TLS is initialized, so they cannot be safely stack-protected. We avoid disabling stack-protection on large numbers of files by using __attribute__ ((__optimize__ ("-fno-stack-protector"))) to turn it off just for the resolvers themselves. (We provide the attribute even when statically linking, because we will later use it elsewhere too.)
Diffstat (limited to 'elf/ifuncdep2.c')
-rw-r--r--elf/ifuncdep2.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/elf/ifuncdep2.c b/elf/ifuncdep2.c
index 6e66d318a6..d87d61d5be 100644
--- a/elf/ifuncdep2.c
+++ b/elf/ifuncdep2.c
@@ -32,6 +32,7 @@ void * foo1_ifunc (void) __asm__ ("foo1");
__asm__(".type foo1, %gnu_indirect_function");
void *
+inhibit_stack_protector
foo1_ifunc (void)
{
return ifunc_sel (one, minus_one, zero);
@@ -41,6 +42,7 @@ void * foo2_ifunc (void) __asm__ ("foo2");
__asm__(".type foo2, %gnu_indirect_function");
void *
+inhibit_stack_protector
foo2_ifunc (void)
{
return ifunc_sel (minus_one, one, zero);
@@ -50,6 +52,7 @@ void * foo3_ifunc (void) __asm__ ("foo3");
__asm__(".type foo3, %gnu_indirect_function");
void *
+inhibit_stack_protector
foo3_ifunc (void)
{
return ifunc_sel (one, zero, minus_one);