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.25-144-ge4e2621


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  e4e26210c3bdb5dcdce7a3def3b90fa45d3e2c89 (commit)
      from  76b2c32a166f4812c0649162c9df99d707779304 (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=e4e26210c3bdb5dcdce7a3def3b90fa45d3e2c89

commit e4e26210c3bdb5dcdce7a3def3b90fa45d3e2c89
Author: Stefan Liebler <stli@linux.vnet.ibm.com>
Date:   Tue Mar 21 16:41:56 2017 +0100

    Fix failing test malloc/tst-interpose-nothread with GCC 7.
    
    The test malloc/tst-interpose-nothread fails on s390x if built
    with GCC 7 and glibc commit "Remove the str(n)dup inlines
    from string/bits/string2.h. Although inlining"
    (ae65d4f3c3995279ca458c460ebf8bab1885fa03) with output:
    error: free: 0x3fffdffa010: invalid allocation index: 0 (not less than 0)
    
    The destructor check_for_allocations in malloc/tst-interpose-aux.c is
    called twice.  One time after the test-child-process has finished successfully
    and once after the test-parent-process finishes.
    During the latter invocation, allocation_index == 0.  GCC 7 is now inlining the
    free function and calls unconditionally fail in get_header as
    header->allocation_index (type == size_t) is always >= allocation_index (= 0).
    Before the mentioned commit above, strdup was replaced by strlen, malloc and
    memcpy.  The malloc call was also inlined and allocation_index was set to one.
    
    This patch moves the already existing compiler barrier before the invocation
    of free.
    
    ChangeLog:
    
    	* malloc/tst-interpose-aux.c (check_for_allocations):
    	Move compiler barrier before free.

diff --git a/ChangeLog b/ChangeLog
index eb5b25a..d8990ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-03-21  Stefan Liebler  <stli@linux.vnet.ibm.com>
+
+	* malloc/tst-interpose-aux.c (check_for_allocations):
+	Move compiler barrier before free.
+
 2017-03-20  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #21279]
diff --git a/malloc/tst-interpose-aux.c b/malloc/tst-interpose-aux.c
index e80e979..68282b4 100644
--- a/malloc/tst-interpose-aux.c
+++ b/malloc/tst-interpose-aux.c
@@ -113,11 +113,11 @@ check_for_allocations (void)
     {
       /* Make sure that malloc is called at least once from libc.  */
       void *volatile ptr = strdup ("ptr");
-      free (ptr);
       /* Compiler barrier.  The strdup function calls malloc, which
          updates allocation_index, but strdup is marked __THROW, so
          the compiler could optimize away the reload.  */
       __asm__ volatile ("" ::: "memory");
+      free (ptr);
       /* If the allocation count is still zero, it means we did not
          interpose malloc successfully.  */
       if (allocation_index == 0)

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

Summary of changes:
 ChangeLog                  |    5 +++++
 malloc/tst-interpose-aux.c |    2 +-
 2 files changed, 6 insertions(+), 1 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]