]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
x86: Assume --enable-cet if GCC defaults to CET [BZ #25225]
authorFlorian Weimer <fweimer@redhat.com>
Tue, 3 Dec 2019 20:11:32 +0000 (21:11 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Tue, 3 Dec 2019 20:11:32 +0000 (21:11 +0100)
This links in CET support if GCC defaults to CET.  Otherwise, __CET__
is defined, yet CET functionality is not compiled and linked into the
dynamic loader, resulting in a linker failure due to undefined
references to _dl_cet_check and _dl_open_check.

(cherry picked from commit 9fb8139079ef0bb1aa33a4ae418cbb113b9b9da7)

NEWS
configure
configure.ac

diff --git a/NEWS b/NEWS
index 74efb0e6e844b383bfaa5c6dbd883fb7dacd0f9f..d488f14ae59815dd092b60765ac68aa2186f59ed 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -71,6 +71,7 @@ The following bugs are resolved with this release:
   [24744] io: Remove the copy_file_range emulation.
   [25203] libio: Disable vtable validation for pre-2.1 interposed handles
   [25204] Ignore LD_PREFER_MAP_32BIT_EXEC for SUID programs
+  [25225] ld.so fails to link on x86 if GCC defaults to -fcf-protection
 
 Security related changes:
 
index fde57d63fe6aba4a13d21346da7bf5534d2fc419..c02753c0fe9c8899e4ff60afe3a08fd29324812e 100755 (executable)
--- a/configure
+++ b/configure
@@ -3762,11 +3762,32 @@ else
 fi
 
 
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+#ifndef __CET__
+#error no CET compiler support
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libc_cv_compiler_default_cet=yes
+else
+  libc_cv_compiler_default_cet=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
 # Check whether --enable-cet was given.
 if test "${enable_cet+set}" = set; then :
   enableval=$enable_cet; enable_cet=$enableval
 else
-  enable_cet=no
+  enable_cet=$libc_cv_compiler_default_cet
 fi
 
 
index 014e09a5d58d102d208ddfaa192d844b1792d94f..139554b94aacb12cf1048f5d67881fa754a34dd5 100644 (file)
@@ -464,11 +464,18 @@ AC_ARG_ENABLE([mathvec],
              [build_mathvec=$enableval],
              [build_mathvec=notset])
 
+AC_TRY_COMPILE([], [
+#ifndef __CET__
+# error no CET compiler support
+#endif],
+              [libc_cv_compiler_default_cet=yes],
+              [libc_cv_compiler_default_cet=no])
+
 AC_ARG_ENABLE([cet],
              AC_HELP_STRING([--enable-cet],
                             [enable Intel Control-flow Enforcement Technology (CET), x86 only]),
              [enable_cet=$enableval],
-             [enable_cet=no])
+             [enable_cet=$libc_cv_compiler_default_cet])
 
 # We keep the original values in `$config_*' and never modify them, so we
 # can write them unchanged into config.make.  Everything else uses