This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Hanging conftest


On 12/04/2013 03:38 AM, PÃdraig Brady wrote:
> Unfortunately I'm seeing cores with this.
> 
> #0  0x000000375ce35215 in raise	() from /lib64/libc.so.6
> #1  0x000000375ce36b2b in abort	() from /lib64/libc.so.6
> #2  0x000000375ce78550 in malloc_printerr () from /lib64/libc.so.6
> #3  0x000000375ce79fc0 in _int_malloc () from /lib64/libc.so.6
> #4  0x000000375ce7a836 in malloc_check () from /lib64/libc.so.6
> #5  0x000000375ce7d4bf in calloc () from /lib64/libc.so.6
> #6  0x000000375cebb6b4 in re_acquire_state_context () from /lib64/libc.so.6
> #7  0x000000375cec1e6a in re_search_internal ()	from /lib64/libc.so.6
> #8  0x000000375cec64ac in re_search_stub () from /lib64/libc.so.6
> #9  0x000000375cec6eb8 in re_search () from /lib64/libc.so.6
> #10 0x000000000040081c in main () at t.c:84
> 
> Ah so mallopt(M_CHECK_ACTION, 2) is documented to abort() on error.
> I suppose we need to suppress core dumps now with the gnulib
> ]GL_NOCRASH[ ... nocrash_init() guard?
> Actually no, that doesn't catch SIGABRT.
> So I suppose you need an explicitly exit(1) in a SIGABRT
> signal handler in this test?

I installed the attached to convert the SIGABRT to a SIGTERM,
since _exit(1) wouldn't be distinguishable from the result |= 1 failure.

thanks,
PÃdraig.
>From 51a2203392d4199bf79d97f50db1b10a29a4f2a1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Wed, 4 Dec 2013 12:11:40 +0000
Subject: [PATCH] regex: suppress core dumps from detection code

* m4/regex.m4 (gl_REGEX): Catch the SIGABRT and convert to SIGTERM
to suppress core dumps that may well occur on glibc systems.
These core dumps might not be cleaned up automatically, or could
trigger some system core dump handling logic.
---
 ChangeLog   |    8 ++++++++
 m4/regex.m4 |   14 +++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 50a16ef..3a7feac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-12-04  Pádraig Brady <P@draigBrady.com>
+
+	regex: suppress core dumps from detection code
+	* m4/regex.m4 (gl_REGEX): Catch the SIGABRT and convert to SIGTERM
+	to suppress core dumps that may well occur on glibc systems.
+	These core dumps might not be cleaned up automatically, or could
+	trigger some system core dump handling logic.
+
 2013-12-03  Pádraig Brady <P@draigBrady.com>
 
 	md5, sha1, sha256, sha512: support mandating use of openssl
diff --git a/m4/regex.m4 b/m4/regex.m4
index 0089c08..795d720 100644
--- a/m4/regex.m4
+++ b/m4/regex.m4
@@ -38,13 +38,20 @@ AC_DEFUN([gl_REGEX],
             #include <locale.h>
             #include <limits.h>
             #include <string.h>
-            #if HAVE_DECL_ALARM
-            # include <unistd.h>
+
+            #if defined M_CHECK_ACTION || HAVE_DECL_ALARM
             # include <signal.h>
+            # include <unistd.h>
             #endif
+
             #if HAVE_MALLOC_H
             # include <malloc.h>
             #endif
+
+            #ifdef M_CHECK_ACTION
+            /* Exit with distinguishable exit code.  */
+            static void sigabrt_no_core (int sig) { raise (SIGTERM); }
+            #endif
           ]],
           [[int result = 0;
             static struct re_pattern_buffer regex;
@@ -61,7 +68,8 @@ AC_DEFUN([gl_REGEX],
             alarm (2);
 #endif
 #ifdef M_CHECK_ACTION
-            mallopt(M_CHECK_ACTION, 2);
+            signal (SIGABRT, sigabrt_no_core);
+            mallopt (M_CHECK_ACTION, 2);
 #endif
 
             if (setlocale (LC_ALL, "en_US.UTF-8"))
-- 
1.7.7.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]