summaryrefslogtreecommitdiffstats
path: root/package/sudo/0004-Actually-link-the-test-program-when-checking-for-stack-protector.patch
diff options
context:
space:
mode:
authorVicente Olivert Riera <Vincent.Riera@imgtec.com>2015-10-30 16:05:35 +0000
committerPeter Korsgaard <peter@korsgaard.com>2015-10-31 10:02:08 +0100
commit40c2b4e95297761aa7c40d7c814b3e209bb4ce55 (patch)
treec035e76ec0941cdf8ac2c0c3c777f2f7a080a18a /package/sudo/0004-Actually-link-the-test-program-when-checking-for-stack-protector.patch
parentd5f36eb63d7b3dd0104b8ce3458b8d0b54dd883f (diff)
downloadbuildroot-40c2b4e95297761aa7c40d7c814b3e209bb4ce55.tar.gz
buildroot-40c2b4e95297761aa7c40d7c814b3e209bb4ce55.zip
sudo: fix -fstack-protector detection
Backport a patch series from upstream to fix the configure check for -fstack-protector. Fixes: http://autobuild.buildroot.net/results/bdd3e5352aa283b96717202a794f9762d15cc736/ Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Diffstat (limited to 'package/sudo/0004-Actually-link-the-test-program-when-checking-for-stack-protector.patch')
-rw-r--r--package/sudo/0004-Actually-link-the-test-program-when-checking-for-stack-protector.patch189
1 files changed, 189 insertions, 0 deletions
diff --git a/package/sudo/0004-Actually-link-the-test-program-when-checking-for-stack-protector.patch b/package/sudo/0004-Actually-link-the-test-program-when-checking-for-stack-protector.patch
new file mode 100644
index 0000000000..87dc29be49
--- /dev/null
+++ b/package/sudo/0004-Actually-link-the-test-program-when-checking-for-stack-protector.patch
@@ -0,0 +1,189 @@
+When checking for stack protector support we need to actually link the
+test program.
+
+Backported from upstream:
+ http://www.sudo.ws/repos/sudo/rev/ab4f94aac7de
+
+Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
+
+# HG changeset patch
+# User Todd C. Miller <Todd.Miller@courtesan.com>
+# Date 1446216562 21600
+# Node ID ab4f94aac7de73efa1b201890354c74126baf7ca
+# Parent e6bc59225c06c5d45580197519a73e3feea14cbd
+When checking for stack protector support we need to actually link
+the test program.
+
+diff -r e6bc59225c06 -r ab4f94aac7de configure
+--- a/configure Thu Oct 29 14:06:21 2015 -0600
++++ b/configure Fri Oct 30 08:49:22 2015 -0600
+@@ -23922,11 +23922,17 @@
+ $as_echo_n "(cached) " >&6
+ else
+
+- sudo_cv_var_stack_protector=no
++ # Avoid using CFLAGS since the compiler might optimize away our
++ # test. We don't want LIBS to interfere with the test but keep
++ # LDFLAGS as it may have an rpath needed to find the ssp lib.
+ _CFLAGS="$CFLAGS"
+ _LDFLAGS="$LDFLAGS"
+- CFLAGS="-fstack-protector-strong"
+- LDFLAGS="$_LDFLAGS -fstack-protector-strong"
++ _LIBS="$LIBS"
++ LIBS=
++
++ sudo_cv_var_stack_protector="-fstack-protector-strong"
++ CFLAGS="$sudo_cv_var_stack_protector"
++ LDFLAGS="$_LDFLAGS $sudo_cv_var_stack_protector"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+
+@@ -23940,14 +23946,13 @@
+ }
+
+ _ACEOF
+-if ac_fn_c_try_compile "$LINENO"; then :
+-
+- sudo_cv_var_stack_protector="-fstack-protector-strong"
+-
+-else
+-
+- CFLAGS="-fstack-protector-all"
+- LDFLAGS="$_LDFLAGS -fstack-protector-all"
++if ac_fn_c_try_link "$LINENO"; then :
++
++else
++
++ sudo_cv_var_stack_protector="-fstack-protector-all"
++ CFLAGS="$sudo_cv_var_stack_protector"
++ LDFLAGS="$_LDFLAGS $sudo_cv_var_stack_protector"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+
+@@ -23961,14 +23966,13 @@
+ }
+
+ _ACEOF
+-if ac_fn_c_try_compile "$LINENO"; then :
+-
+- sudo_cv_var_stack_protector="-fstack-protector-all"
+-
+-else
+-
+- CFLAGS="-fstack-protector"
+- LDFLAGS="$_LDFLAGS -fstack-protector"
++if ac_fn_c_try_link "$LINENO"; then :
++
++else
++
++ sudo_cv_var_stack_protector="-fstack-protector"
++ CFLAGS="$sudo_cv_var_stack_protector"
++ LDFLAGS="$_LDFLAGS $sudo_cv_var_stack_protector"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+
+@@ -23982,20 +23986,26 @@
+ }
+
+ _ACEOF
+-if ac_fn_c_try_compile "$LINENO"; then :
+-
+- sudo_cv_var_stack_protector="-fstack-protector"
+-
+-fi
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-
+-fi
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-
+-fi
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++if ac_fn_c_try_link "$LINENO"; then :
++
++else
++
++ sudo_cv_var_stack_protector=no
++
++fi
++rm -f core conftest.err conftest.$ac_objext \
++ conftest$ac_exeext conftest.$ac_ext
++
++fi
++rm -f core conftest.err conftest.$ac_objext \
++ conftest$ac_exeext conftest.$ac_ext
++
++fi
++rm -f core conftest.err conftest.$ac_objext \
++ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS="$_CFLAGS"
+ LDFLAGS="$_LDFLAGS"
++ LIBS="$_LIBS"
+
+
+ fi
+diff -r e6bc59225c06 -r ab4f94aac7de configure.ac
+--- a/configure.ac Thu Oct 29 14:06:21 2015 -0600
++++ b/configure.ac Fri Oct 30 08:49:22 2015 -0600
+@@ -3981,37 +3981,42 @@
+ AC_CACHE_CHECK([for compiler stack protector support],
+ [sudo_cv_var_stack_protector],
+ [
+- sudo_cv_var_stack_protector=no
++ # Avoid using CFLAGS since the compiler might optimize away our
++ # test. We don't want LIBS to interfere with the test but keep
++ # LDFLAGS as it may have an rpath needed to find the ssp lib.
+ _CFLAGS="$CFLAGS"
+ _LDFLAGS="$LDFLAGS"
+- CFLAGS="-fstack-protector-strong"
+- LDFLAGS="$_LDFLAGS -fstack-protector-strong"
+- AC_COMPILE_IFELSE([
++ _LIBS="$LIBS"
++ LIBS=
++
++ sudo_cv_var_stack_protector="-fstack-protector-strong"
++ CFLAGS="$sudo_cv_var_stack_protector"
++ LDFLAGS="$_LDFLAGS $sudo_cv_var_stack_protector"
++ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
+ [[char buf[1024]; buf[1023] = '\0';]])
+- ], [
+- sudo_cv_var_stack_protector="-fstack-protector-strong"
+- ], [
+- CFLAGS="-fstack-protector-all"
+- LDFLAGS="$_LDFLAGS -fstack-protector-all"
+- AC_COMPILE_IFELSE([
++ ], [], [
++ sudo_cv_var_stack_protector="-fstack-protector-all"
++ CFLAGS="$sudo_cv_var_stack_protector"
++ LDFLAGS="$_LDFLAGS $sudo_cv_var_stack_protector"
++ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
+ [[char buf[1024]; buf[1023] = '\0';]])
+- ], [
+- sudo_cv_var_stack_protector="-fstack-protector-all"
+- ], [
+- CFLAGS="-fstack-protector"
+- LDFLAGS="$_LDFLAGS -fstack-protector"
+- AC_COMPILE_IFELSE([
++ ], [], [
++ sudo_cv_var_stack_protector="-fstack-protector"
++ CFLAGS="$sudo_cv_var_stack_protector"
++ LDFLAGS="$_LDFLAGS $sudo_cv_var_stack_protector"
++ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
+ [[char buf[1024]; buf[1023] = '\0';]])
+- ], [
+- sudo_cv_var_stack_protector="-fstack-protector"
+- ], [])
++ ], [], [
++ sudo_cv_var_stack_protector=no
++ ])
+ ])
+ ])
+ CFLAGS="$_CFLAGS"
+ LDFLAGS="$_LDFLAGS"
++ LIBS="$_LIBS"
+ ]
+ )
+ if test X"$sudo_cv_var_stack_protector" != X"no"; then
+
OpenPOWER on IntegriCloud