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.26.9000-800-g8beba15


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  8beba15d536aa5c89e9e55e4c497c0bcd10cb67c (commit)
       via  80eb52e3a93a9f611a415a3565d17536cf023f8a (commit)
      from  567d8c1f6852c5d5aad4d46da34b6276e400d5dd (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=8beba15d536aa5c89e9e55e4c497c0bcd10cb67c

commit 8beba15d536aa5c89e9e55e4c497c0bcd10cb67c
Author: Stefan Liebler <stli@linux.vnet.ibm.com>
Date:   Tue Nov 21 08:45:28 2017 +0100

    S390: Add cfi information for start routines in order to stop unwinding.
    
    GDB failed to detect the outermost frame while showing the backtrace
    within a thread:
    Backtrace stopped: previous frame identical to this frame (corrupt stack?)
    
    Before this patch, the start routines like thread_start had no cfi information.
    GDB is then using the prologue unwinder if no cfi information is available.
    This unwinder tries to unwind r15 and stops e.g. if r15 was updated or
    on some jump-instructions.
    
    On older glibc-versions (before commit "Remove cached PID/TID in clone"
    c579f48edba88380635ab98cb612030e3ed8691e), the thread_start function used
    such a jump-instruction and GDB did not fail with an error.
    
    This patch adds cfi information for _start, thread_start and __makecontext_ret
    and marks r14 as undefined which marks the frame as outermost frame and GDB
    stops the backtrace. Also tested different gcc versions in order to test
    _Unwind_Backtrace() in libgcc as this is used by backtrace() in glibc.
    
    ChangeLog:
    
    	* sysdeps/s390/s390-64/start.S (_start): Add cfi information for r14.
    	* sysdeps/s390/s390-32/start.S: (_start): Likewise
    	* sysdeps/unix/sysv/linux/s390/s390-64/clone.S
    	(thread_start): Likewise.
    	* sysdeps/unix/sysv/linux/s390/s390-32/clone.S
    	(thread_start): Likewise.
    	* sysdeps/unix/sysv/linux/s390/s390-64/__makecontext_ret.S
    	(__makecontext_ret): Likewise.
    	* sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S
    	(__makecontext_ret): Likewise.

diff --git a/ChangeLog b/ChangeLog
index ca6024c..f9e2e18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2017-11-21  Stefan Liebler  <stli@linux.vnet.ibm.com>
 
+	* sysdeps/s390/s390-64/start.S (_start): Add cfi information for r14.
+	* sysdeps/s390/s390-32/start.S (_start): Likewise
+	* sysdeps/unix/sysv/linux/s390/s390-64/clone.S
+	(thread_start): Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-32/clone.S
+	(thread_start): Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-64/__makecontext_ret.S
+	(__makecontext_ret): Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S
+	(__makecontext_ret): Likewise.
+
+2017-11-21  Stefan Liebler  <stli@linux.vnet.ibm.com>
+
 	* include/wchar.h (__wcsnlen, __wcscat, __wcsncpy, __wcpncpy,
 	__wcschrnul): Remove attribute_hidden.
 
diff --git a/sysdeps/s390/s390-32/start.S b/sysdeps/s390/s390-32/start.S
index 07400f1..66c00f3 100644
--- a/sysdeps/s390/s390-32/start.S
+++ b/sysdeps/s390/s390-32/start.S
@@ -34,6 +34,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <sysdep.h>
+
 /*
    This is the canonical entry point, usually the first thing in the text
    segment. Most registers' values are unspecified, except for:
@@ -57,6 +59,10 @@
 	.globl _start
 	.type _start,@function
 _start:
+	cfi_startproc
+	/* Mark r14 as undefined in order to stop unwinding here!  */
+	cfi_undefined (r14)
+
 	/* Check if the kernel provides highgprs facility if needed by
 	   the binary.  */
 
@@ -188,6 +194,7 @@ _start:
 	/* crash if __libc_start_main returns */
 	.word   0
 
+	cfi_endproc
 .Llit:
 #ifndef PIC
 .L1:    .long  __libc_csu_init
diff --git a/sysdeps/s390/s390-64/start.S b/sysdeps/s390/s390-64/start.S
index d8e6545..d3e62d2 100644
--- a/sysdeps/s390/s390-64/start.S
+++ b/sysdeps/s390/s390-64/start.S
@@ -34,6 +34,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <sysdep.h>
+
 /*
    This is the canonical entry point, usually the first thing in the text
    segment. Most registers' values are unspecified, except for:
@@ -57,6 +59,9 @@
 	.globl _start
 	.type _start,@function
 _start:
+	cfi_startproc
+	/* Mark r14 as undefined in order to stop unwinding here!  */
+	cfi_undefined (r14)
 	/* Load argc and argv from stack.  */
 	la	%r4,8(%r15)		# get argv
 	lg	%r3,0(%r15)		# get argc
@@ -91,6 +96,8 @@ _start:
 	/* Crash if __libc_start_main returns.	*/
 	.word	0
 
+	cfi_endproc
+
 	/* Define a symbol for the first piece of initialized data.  */
 	.data
 	.globl __data_start
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S b/sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S
index 887d841..ba38a30 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S
@@ -17,15 +17,9 @@
 
 #include <sysdep.h>
 
-/* We do not want .eh_frame info so that __makecontext_ret stops unwinding
-   if backtrace was called within a context created by makecontext. (There
-   is also no .eh_frame info for _start or thread_start.)  */
-#undef cfi_startproc
-#define cfi_startproc
-#undef cfi_endproc
-#define cfi_endproc
-
 ENTRY(__makecontext_ret)
+	/* Mark r14 as undefined in order to stop unwinding here!  */
+	cfi_undefined (r14)
 	basr  %r14,%r7
 	ltr   %r8,%r8			/* Check whether uc_link is 0.  */
 	jz    1f
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/clone.S b/sysdeps/unix/sysv/linux/s390/s390-32/clone.S
index a8b4dbc..91f8ede 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/clone.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/clone.S
@@ -54,12 +54,16 @@ error:
 PSEUDO_END (__clone)
 
 thread_start:
+	cfi_startproc
+	/* Mark r14 as undefined in order to stop unwinding here!  */
+	cfi_undefined (r14)
 	/* fn is in gpr 1, arg in gpr 0 */
 	lr      %r2,%r0         /* set first parameter to void *arg */
 	ahi     %r15,-96        /* make room on the stack for the save area */
 	xc	0(4,%r15),0(%r15)
 	basr    %r14,%r1        /* jump to fn */
 	DO_CALL (exit, 1)
+	cfi_endproc
 
 libc_hidden_def (__clone)
 weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/__makecontext_ret.S b/sysdeps/unix/sysv/linux/s390/s390-64/__makecontext_ret.S
index 1690163..2dcd43f 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/__makecontext_ret.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/__makecontext_ret.S
@@ -17,15 +17,9 @@
 
 #include <sysdep.h>
 
-/* We do not want .eh_frame info so that __makecontext_ret stops unwinding
-   if backtrace was called within a context created by makecontext. (There
-   is also no .eh_frame info for _start or thread_start.)  */
-#undef cfi_startproc
-#define cfi_startproc
-#undef cfi_endproc
-#define cfi_endproc
-
 ENTRY(__makecontext_ret)
+	/* Mark r14 as undefined in order to stop unwinding here!  */
+	cfi_undefined (r14)
 	basr	%r14,%r7
 	ltgr	%r8,%r8			/* Check whether uc_link is 0.  */
 	jz	1f
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/clone.S b/sysdeps/unix/sysv/linux/s390/s390-64/clone.S
index daf8a58..8b0cc7e 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/clone.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/clone.S
@@ -55,12 +55,16 @@ error:
 PSEUDO_END (__clone)
 
 thread_start:
+	cfi_startproc
+	/* Mark r14 as undefined in order to stop unwinding here!  */
+	cfi_undefined (r14)
 	/* fn is in gpr 1, arg in gpr 0 */
 	lgr	%r2,%r0		/* set first parameter to void *arg */
 	aghi	%r15,-160	/* make room on the stack for the save area */
 	xc	0(8,%r15),0(%r15)
 	basr	%r14,%r1	/* jump to fn */
 	DO_CALL	(exit, 1)
+	cfi_endproc
 
 libc_hidden_def (__clone)
 weak_alias (__clone, clone)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=80eb52e3a93a9f611a415a3565d17536cf023f8a

commit 80eb52e3a93a9f611a415a3565d17536cf023f8a
Author: Stefan Liebler <stli@linux.vnet.ibm.com>
Date:   Tue Nov 21 08:39:53 2017 +0100

    Remove attribute_hidden for wchar ifunc symbols.
    
    On s390 (31bit) various debug/tst-*chk* testcases are failing as the tests
    are ending with a segmentation fault.
    
    One test is e.g. calling wcsnrtombs in debug/tst-chk1.c:1549.
    The function wcsnrtombs itself calls __wcsnlen. This function is called via
    PLT! The PLT-stub itself loads the address from GOT (r12 is assumed to be
    the GOT-pointer). In this case the loaded address is zero and the following
    branch leads to the segmentation fault.
    
    Due to the attribute_hidden in commit 44af8a32c341672b5160fdc2839767e9a837ad26
    "Mark internal wchar functions with attribute_hidden [BZ #18822]"
    for e.g. the __wcsnlen function, r12 is not loaded with the GOT-pointer
    in wcsnrtombs.
    
    On s390x (64bit), this __wcsnlen call is also using the PLT-stub. But it is
    not failing as the GOT-pointer is setup with larl-instruction by the PLT-stub
    itself.
    Note: On s390x/s390, __wcsnlen is an IFUNC symbol.
    
    On x86_64, __wcsnlen is also an IFUNC symbol and is called via PLT, too.
    
    Further IFUNC symbols on s390 which were marked as hidden by the mentioned
    commit are: __wcscat, __wcsncpy, __wcpncpy, __wcschrnul.
    
    This patch removes the attribute_hidden in wchar.h.
    Then the compiler setups e.g. r12 on s390 in order to call __wcsnlen via PLT.
    
    ChangeLog:
    
    	* include/wchar.h (__wcsnlen, __wcscat, __wcsncpy, __wcpncpy,
    	__wcschrnul): Remove attribute_hidden.

diff --git a/ChangeLog b/ChangeLog
index 50da3df..ca6024c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-21  Stefan Liebler  <stli@linux.vnet.ibm.com>
+
+	* include/wchar.h (__wcsnlen, __wcscat, __wcsncpy, __wcpncpy,
+	__wcschrnul): Remove attribute_hidden.
+
 2017-11-20  Paul Eggert  <eggert@cs.ucla.edu>
 
 	regex: don't assume uint64_t or uint32_t
diff --git a/include/wchar.h b/include/wchar.h
index 24b2eaa..1db0ac8 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -152,9 +152,8 @@ extern int __wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2,
      __attribute_pure__;
 extern size_t __wcslen (const wchar_t *__s) __attribute_pure__;
 extern size_t __wcsnlen (const wchar_t *__s, size_t __maxlen)
-     attribute_hidden __attribute_pure__;
-extern wchar_t *__wcscat (wchar_t *dest, const wchar_t *src)
-     attribute_hidden;
+     __attribute_pure__;
+extern wchar_t *__wcscat (wchar_t *dest, const wchar_t *src);
 extern wint_t __btowc (int __c) attribute_hidden;
 extern int __mbsinit (const __mbstate_t *__ps);
 extern size_t __mbrtowc (wchar_t *__restrict __pwc,
@@ -182,11 +181,10 @@ extern size_t __wcsnrtombs (char *__restrict __dst,
 			    __mbstate_t *__restrict __ps)
      attribute_hidden;
 extern wchar_t *__wcsncpy (wchar_t *__restrict __dest,
-			   const wchar_t *__restrict __src, size_t __n)
-     attribute_hidden;
+			   const wchar_t *__restrict __src, size_t __n);
 extern wchar_t *__wcpcpy (wchar_t *__dest, const wchar_t *__src);
 extern wchar_t *__wcpncpy (wchar_t *__dest, const wchar_t *__src,
-			   size_t __n) attribute_hidden;
+			   size_t __n);
 extern wchar_t *__wmemcpy (wchar_t *__s1, const wchar_t *s2,
 			   size_t __n) attribute_hidden;
 extern wchar_t *__wmempcpy (wchar_t *__restrict __s1,
@@ -195,7 +193,7 @@ extern wchar_t *__wmempcpy (wchar_t *__restrict __s1,
 extern wchar_t *__wmemmove (wchar_t *__s1, const wchar_t *__s2,
 			    size_t __n) attribute_hidden;
 extern wchar_t *__wcschrnul (const wchar_t *__s, wchar_t __wc)
-     attribute_hidden __attribute_pure__;
+     __attribute_pure__;
 
 extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n,
 			       size_t __ns) __THROW;

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

Summary of changes:
 ChangeLog                                          |   18 ++++++++++++++++++
 include/wchar.h                                    |   12 +++++-------
 sysdeps/s390/s390-32/start.S                       |    7 +++++++
 sysdeps/s390/s390-64/start.S                       |    7 +++++++
 .../sysv/linux/s390/s390-32/__makecontext_ret.S    |   10 ++--------
 sysdeps/unix/sysv/linux/s390/s390-32/clone.S       |    4 ++++
 .../sysv/linux/s390/s390-64/__makecontext_ret.S    |   10 ++--------
 sysdeps/unix/sysv/linux/s390/s390-64/clone.S       |    4 ++++
 8 files changed, 49 insertions(+), 23 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]