This is the mail archive of the glibc-cvs@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]

GNU C Library master sources branch master updated. glibc-2.21-440-g0224244


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  02242448bf431a69fd0b8c929ca4408a05479baa (commit)
      from  7fe9e2e089f4990b7d18d0798f591ab276b15f2b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=02242448bf431a69fd0b8c929ca4408a05479baa

commit 02242448bf431a69fd0b8c929ca4408a05479baa
Author: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
Date:   Tue Jun 2 10:32:25 2015 -0300

    Avoid outputting to TTY after an expected memory corruption in testcase
    
    Protect TTY against an expected memory corruption from testcase
    tst-malloc-backtrace, which is expected to SIGABRT after a forced memory
    corruption.

diff --git a/ChangeLog b/ChangeLog
index c043fac..e433130 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-05  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
+
+	* malloc/tst-malloc-backtrace.c (do_test): Redirect libc fatal
+	errors to stderr.
+
 2015-06-05  Florian Weimer  <fweimer@redhat.com>
 
 	[BZ #15661]
diff --git a/malloc/tst-malloc-backtrace.c b/malloc/tst-malloc-backtrace.c
index 2e24157..7b317bb 100644
--- a/malloc/tst-malloc-backtrace.c
+++ b/malloc/tst-malloc-backtrace.c
@@ -30,12 +30,22 @@ call_free (void *ptr)
   *(size_t *)(ptr - sizeof (size_t)) = 1;
 }
 
+int do_test (void);
+
+#define TEST_FUNCTION do_test ()
+#define EXPECTED_SIGNAL SIGABRT
+
+#include "../test-skeleton.c"
+
 int
 do_test (void)
 {
   void *ptr1 = malloc (SIZE);
   void *ptr2 = malloc (SIZE);
 
+  /* Avoid unwanted output to TTY after an expected memory corruption.  */
+  ignore_stderr();
+
   call_free (ptr1);
   ptr1 = malloc (SIZE);
 
@@ -43,8 +53,3 @@ do_test (void)
      doesn't optimize out that malloc call.  */
   return (ptr1 == ptr2);
 }
-
-#define TEST_FUNCTION do_test ()
-#define EXPECTED_SIGNAL SIGABRT
-
-#include "../test-skeleton.c"
diff --git a/test-skeleton.c b/test-skeleton.c
index 1332c94..9ee5001 100644
--- a/test-skeleton.c
+++ b/test-skeleton.c
@@ -218,6 +218,22 @@ signal_handler (int sig __attribute__ ((unused)))
   exit (1);
 }
 
+/* Avoid all the buffer overflow messages on stderr.  */
+static void
+__attribute__ ((unused))
+ignore_stderr (void)
+{
+  int fd = open (_PATH_DEVNULL, O_WRONLY);
+  if (fd == -1)
+    close (STDERR_FILENO);
+  else
+    {
+      dup2 (fd, STDERR_FILENO);
+      close (fd);
+    }
+  setenv ("LIBC_FATAL_STDERR_", "1", 1);
+}
+
 /* Set fortification error handler.  Used when tests want to verify that bad
    code is caught by the library.  */
 static void
@@ -231,17 +247,7 @@ set_fortify_handler (void (*handler) (int sig))
   sigemptyset (&sa.sa_mask);
 
   sigaction (SIGABRT, &sa, NULL);
-
-  /* Avoid all the buffer overflow messages on stderr.  */
-  int fd = open (_PATH_DEVNULL, O_WRONLY);
-  if (fd == -1)
-    close (STDERR_FILENO);
-  else
-    {
-      dup2 (fd, STDERR_FILENO);
-      close (fd);
-    }
-  setenv ("LIBC_FATAL_STDERR_", "1", 1);
+  ignore_stderr ();
 }
 
 /* We provide the entry point here.  */

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                     |    5 +++++
 malloc/tst-malloc-backtrace.c |   15 ++++++++++-----
 test-skeleton.c               |   28 +++++++++++++++++-----------
 3 files changed, 32 insertions(+), 16 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


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