APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1510697597 0
# Tue Nov 14 22:13:17 2017 +0000
# Node ID 00726cf7425524d7ad434590c8594ae05ee4eda4
# Parent c9a5d4d11d27e7a49923301f859f1f146b47dda6
Detect and disable ASLR for pdump on Linux as well as on Darwin.
ChangeLog addition:
2017-11-14 Aidan Kehoe <kehoea(a)parhasard.net>
* configure: Regenerate.
* configure.ac:
Detect and disable ASLR on Linux as well as on Darwin, it doesn't
work with our approach to dumping.
Limit this to the main xemacs binary, not movemail, gnuclient and so
on.
diff -r c9a5d4d11d27 -r 00726cf74255 ChangeLog
--- a/ChangeLog Tue Nov 14 14:44:50 2017 +0000
+++ b/ChangeLog Tue Nov 14 22:13:17 2017 +0000
@@ -1,3 +1,12 @@
+2017-11-14 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * configure: Regenerate.
+ * configure.ac:
+ Detect and disable ASLR on Linux as well as on Darwin, it doesn't
+ work with our approach to dumping.
+ Limit this to the main xemacs binary, not movemail, gnuclient and so
+ on.
+
2017-11-07 Aidan Kehoe <kehoea(a)parhasard.net>
* configure.ac (XE_COMPLEX_ARG):
diff -r c9a5d4d11d27 -r 00726cf74255 configure
--- a/configure Tue Nov 14 14:44:50 2017 +0000
+++ b/configure Tue Nov 14 22:13:17 2017 +0000
@@ -12265,10 +12265,53 @@
Darwin:1[123456].*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- LDFLAGS="$LDFLAGS -Wl,-no_pie" && if test "$verbose" =
"yes"; then echo " Appending \"-Wl,-no_pie\" to
\$LDFLAGS"; fi
+ start_flags="$start_flags -Wl,-no_pie" && if test
"$verbose" = "yes"; then echo " Appending
\"-Wl,-no_pie\" to \$start_flags"; fi
;;
- *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; } ;;
+ *)
+ if test "$cross_compiling" = yes; then :
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':"
>&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int main () {
+#if defined __GNUC__ && defined __pie__
+ return __pie__;
+#else
+ return 0;
+#endif
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+else
+ __pie__="$?";
+case "$__pie__" in
+ 2)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, disabling -fPIE"
>&5
+$as_echo "yes, disabling -fPIE" >&6; }
+ start_flags="$start_flags -no-pie" && if test "$verbose"
= "yes"; then echo " Appending \"-no-pie\" to
\$start_flags"; fi
+ ;;
+ 1)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, disabling -fpie"
>&5
+$as_echo "yes, disabling -fpie" >&6; }
+ start_flags="$start_flags -no-pie" && if test "$verbose" =
"yes"; then echo " Appending \"-no-pie\" to
\$start_flags"; fi
+ ;;
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized __pie__ define
$__pie__, attempting to disable ASLR with -no-pie" >&5
+$as_echo "$as_me: WARNING: unrecognized __pie__ define $__pie__, attempting to
disable ASLR with -no-pie" >&2;}
+ start_flags="$start_flags -no-pie" && if test "$verbose" =
"yes"; then echo " Appending \"-no-pie\" to
\$start_flags"; fi
+ ;;
+esac
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ ;;
esac
diff -r c9a5d4d11d27 -r 00726cf74255 configure.ac
--- a/configure.ac Tue Nov 14 14:44:50 2017 +0000
+++ b/configure.ac Tue Nov 14 22:13:17 2017 +0000
@@ -2839,16 +2839,44 @@
fi
fi
-dnl Disable ASLR on systems where it breaks pdump.
+dnl Disable ASLR on systems where it breaks pdump. Use $start_flags for this
+dnl rather than $LDFLAGS, so it's only done for the XEmacs binary, and
+dnl gnuclient, movemail and so on get ASLR if the system defaults to it.
AC_MSG_CHECKING([whether ASLR needs to be disabled])
case `uname -s`:`uname -r` in
dnl Mac OS X 10.7 Lion, 10.8 Mountain Lion, 10.9 Mavericks,
dnl 10.10 Yosemite, 10.11 El Capitan, 10.12 Sierra
Darwin:1[[123456]].*)
AC_MSG_RESULT(yes)
- XE_APPEND([-Wl,-no_pie], LDFLAGS)
+ XE_APPEND([-Wl,-no_pie], start_flags)
;;
- *) AC_MSG_RESULT(no) ;;
+ *)
+ AC_RUN_IFELSE([AC_LANG_SOURCE([int main () {
+#if defined __GNUC__ && defined __pie__
+ return __pie__;
+#else
+ return 0;
+#endif
+}])], [AC_MSG_RESULT(no)],
+[__pie__="$?";
+case "$__pie__" in
+ 2)
+ AC_MSG_RESULT([yes, disabling -fPIE])
+ dnl We need to do this after the XE_PROTECT_LINKER_FLAGS() call,
+ dnl above. On Debian 9.2 Stretch the linker does not recognise
+ dnl -no-pie, it needs to be handled by the GCC invocation.
+ XE_APPEND([-no-pie], start_flags)
+ ;;
+ 1)
+ AC_MSG_RESULT([yes, disabling -fpie])
+ XE_APPEND([-no-pie], start_flags)
+ ;;
+ *)
+ AC_MSG_WARN([unrecognized __pie__ define $__pie__, attempting to disable ASLR with
-no-pie])
+ XE_APPEND([-no-pie], start_flags)
+ ;;
+esac])
+ ;;
esac
dnl ----------------------
--
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)