summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-09-15 11:51:26 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-09-15 11:51:26 +0100
commit79c35a7d5a35efb425005d99d13662a29e416d19 (patch)
tree9e6ba605b42a2e240fdc7fb4061372e6e3f0e3fb
parent02731e3718588920870576f23628507c51cd804d (diff)
parent900011a26816c7cc84f0a8b502eea6c4301823d0 (diff)
downloaddbus-79c35a7d5a35efb425005d99d13662a29e416d19.tar.gz
Merge branch 'dbus-1.8'
-rw-r--r--NEWS4
-rw-r--r--configure.ac4
-rw-r--r--test/test-segfault.c18
3 files changed, 25 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index c7678074..c838e08d 100644
--- a/NEWS
+++ b/NEWS
@@ -49,6 +49,10 @@ Fixes:
the older separate libraries if not found (Umut Tezduyar Lindskog,
Simon McVittie)
+• On Linux, use prctl() to disable core dumps from a test executable
+ that deliberately raises SIGSEGV to test dbus-daemon's handling
+ of that condition (fd.o #83772, Simon McVittie)
+
• Fix compilation with --enable-stats (fd.o #81043, Gentoo #507232;
Alban Crequy)
diff --git a/configure.ac b/configure.ac
index 09eb0406..646c006d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -598,6 +598,10 @@ if test "x$ac_cv_header_syslog_h" = "xyes"; then
AC_CHECK_DECLS([LOG_PERROR], [], [], [[#include <syslog.h>]])
fi
+# For test-segfault.c
+AC_CHECK_HEADERS_ONCE([sys/prctl.h])
+AC_CHECK_FUNCS_ONCE([prctl raise])
+
#### Check for broken poll; taken from Glib's configure
AC_MSG_CHECKING([for broken poll])
diff --git a/test/test-segfault.c b/test/test-segfault.c
index 329a21fd..c062ce1c 100644
--- a/test/test-segfault.c
+++ b/test/test-segfault.c
@@ -9,18 +9,34 @@
#include <sys/resource.h>
#endif
+#ifdef HAVE_SYS_PRCTL_H
+#include <sys/prctl.h>
+#endif
+
int
main (int argc, char **argv)
{
char *p;
#if HAVE_SETRLIMIT
+ /* No core dumps please, we know we crashed. */
struct rlimit r = { 0, };
getrlimit (RLIMIT_CORE, &r);
r.rlim_cur = 0;
setrlimit (RLIMIT_CORE, &r);
-
+#endif
+
+#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)
+ /* Really, no core dumps please. On Linux, if core_pattern is
+ * set to a pipe (for abrt/apport/corekeeper/etc.), RLIMIT_CORE of 0
+ * is ignored (deliberately, so people can debug init(8) and other
+ * early stuff); but Linux has PR_SET_DUMPABLE, so we can avoid core
+ * dumps anyway. */
+ prctl (PR_SET_DUMPABLE, 0, 0, 0, 0);
+#endif
+
+#ifdef HAVE_RAISE
raise (SIGSEGV);
#endif
p = NULL;