[PATCH 2/3] Disable stack protector for ifunc resolvers in tests

Siddhesh Poyarekar siddhesh@sourceware.org
Tue Mar 9 18:12:58 GMT 2021


IFUNC resolvers get called too early for stack protector to be useful,
so fix the elf tests to disable stack protector for the resolver
functions.  This fixes test failures in the static tests on x86_64.
---
 elf/ifuncmain9.c            | 1 +
 sysdeps/x86/tst-ifunc-isa.h | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/elf/ifuncmain9.c b/elf/ifuncmain9.c
index 2c4e95a051..e775c5cfa9 100644
--- a/elf/ifuncmain9.c
+++ b/elf/ifuncmain9.c
@@ -43,6 +43,7 @@ implementation (void)
 }
 
 static __typeof__ (implementation) *
+inhibit_stack_protector
 resolver (void)
 {
   ++resolver_called;
diff --git a/sysdeps/x86/tst-ifunc-isa.h b/sysdeps/x86/tst-ifunc-isa.h
index 60aa1cea6a..6d906966a7 100644
--- a/sysdeps/x86/tst-ifunc-isa.h
+++ b/sysdeps/x86/tst-ifunc-isa.h
@@ -29,6 +29,7 @@ enum isa
 };
 
 enum isa
+__attribute__ ((__optimize__ ("-fno-stack-protector")))
 get_isa (void)
 {
   if (CPU_FEATURE_USABLE (AVX512F))
@@ -83,6 +84,7 @@ isa_none (void)
 int foo (void) __attribute__ ((ifunc ("foo_ifunc")));
 
 void *
+__attribute__ ((__optimize__ ("-fno-stack-protector")))
 foo_ifunc (void)
 {
   switch (get_isa ())
-- 
2.29.2



More information about the Libc-alpha mailing list