]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Build get-cpuid-feature-leaf.c without stack-protector [BZ #27555]
authorSiddhesh Poyarekar <siddhesh@sourceware.org>
Mon, 15 Mar 2021 14:54:45 +0000 (20:24 +0530)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Mon, 15 Mar 2021 14:54:45 +0000 (20:24 +0530)
__x86_get_cpuid_feature_leaf is called during early startup, before
the stack check guard is initialized and is hence not safe to build
with stack-protector.

Additionally, IFUNC resolvers for static tst-ifunc-isa tests get
called too early for stack protector to be useful, so fix them to
disable stack protector for the resolver functions.

This fixes all failures seen with --enable-stack-protector=all
configuration.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
sysdeps/x86/Makefile
sysdeps/x86/tst-ifunc-isa.h

index 06c9f84f51771e6dbbf4a99465f703cf586e063b..3ca7bfefe488276fedce178a4ff757e8f128b89b 100644 (file)
@@ -7,6 +7,8 @@ sysdep_routines += get-cpuid-feature-leaf
 sysdep-dl-routines += dl-get-cpu-features
 sysdep_headers += sys/platform/x86.h
 
+CFLAGS-get-cpuid-feature-leaf.o += $(no-stack-protector)
+
 tests += tst-get-cpu-features tst-get-cpu-features-static \
         tst-cpu-features-cpuinfo tst-cpu-features-cpuinfo-static \
         tst-cpu-features-supports tst-cpu-features-supports-static
index 60aa1cea6af8a4e53452ab67486e417472ffc14a..6d906966a7935f253efd75d6c6331cff531d2a30 100644 (file)
@@ -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 ())