glibc/sysdeps
Stefan Liebler 890b7a4b33 S390: Fix "backtrace() returns infinitely deep stack frames with makecontext()" [BZ #18508].
On s390/s390x backtrace(buffer, size) returns the series of called functions until
"makecontext_ret" and additional entries (up to "size") with "makecontext_ret".
GDB-backtrace is also warning:
"Backtrace stopped: previous frame identical to this frame (corrupt stack?)"

To reproduce this scenario you have to setup a new context with makecontext()
and activate it with setcontext(). See e.g. cf() function in testcase stdlib/tst-makecontext.c.
Or see bug in libgo "Bug 66303 - runtime.Caller() returns infinitely deep stack frames
on s390x " (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66303).

This patch omits the cfi_startproc/cfi_endproc directives in ENTRY/END macro of
__makecontext_ret. Thus no frame information is generated in .eh_frame and backtrace
stops after __makecontext_ret. There is also no .eh_frame info for _start or
thread_start functions.

ChangeLog:

	[BZ #18508]
	* stdlib/Makefile ($(objpfx)tst-makecontext3):
	Depend on $(libdl).
	* stdlib/tst-makecontext.c (cf): Test if _Unwind_Backtrace
	is not called infinitely times.
	(backtrace_helper): New function.
	(trace_arg): New struct.
	(st1): Enlarge stack size.
	* sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S:
	(__makecontext_ret): Omit cfi_startproc and cfi_endproc.
	* sysdeps/unix/sysv/linux/s390/s390-64/__makecontext_ret.S:
	Likewise.
2015-07-07 16:11:14 +02:00
..
aarch64 Inline __ieee754_sqrt and __ieee754_sqrtf. Also add external definitions. 2015-07-06 12:52:55 +01:00
alpha alpha: Update libm-test-ulps 2015-05-19 09:43:54 -07:00
arm Regenerate ARM libm-test-ulps. 2015-07-01 17:50:15 +00:00
generic Refactoring of START for conditions in individual tests 2015-05-14 18:07:06 +03:00
gnu hurd: fix unwind-resume.c build 2015-02-08 18:46:00 +01:00
hppa hppa: Fix feupdateenv and fesetexceptflag (Bug 18111). 2015-03-11 02:48:59 -04:00
i386 Add and use sysdeps/i386/link-defines.sym 2015-07-07 05:23:40 -07:00
ia64 Set errno for log1p on pole/domain error. 2015-04-13 21:19:27 +02:00
ieee754 Remove unused file sysdeps/ieee754/support.c 2015-07-06 12:51:30 +01:00
init_array NPTL: Initializer for .init_array-only configurations. 2015-02-13 13:19:11 -08:00
m68k Set errno for log1p on pole/domain error. 2015-04-13 21:19:27 +02:00
mach Fix nice getpriority, setpriority namespace (bug 18553). 2015-06-17 20:22:39 +00:00
microblaze Replace ELF_RTYPE_CLASS_NOCOPY with ELF_RTYPE_CLASS_COPY 2015-03-05 08:40:41 -08:00
mips Regenerate MIPS libm-test-ulps. 2015-07-01 17:24:37 +00:00
nacl Clean up BUSY_WAIT_NOP and atomic_delay. 2015-06-30 15:57:15 +02:00
nios2 Replace ELF_RTYPE_CLASS_NOCOPY with ELF_RTYPE_CLASS_COPY 2015-03-05 08:40:41 -08:00
nptl Use unsigned types for counters in getaddrinfo_a code. 2015-06-24 17:58:12 -07:00
posix Fix nice getpriority, setpriority namespace (bug 18553). 2015-06-17 20:22:39 +00:00
powerpc Regenerate powerpc-nofpu libm-test-ulps. 2015-07-01 18:04:28 +00:00
pthread Use unsigned types for counters in AIO code. 2015-06-24 17:43:32 -07:00
s390 S390: Regenerate ULPs. 2015-07-07 16:11:14 +02:00
sh Replace ELF_RTYPE_CLASS_NOCOPY with ELF_RTYPE_CLASS_COPY 2015-03-05 08:40:41 -08:00
sparc Clean up BUSY_WAIT_NOP and atomic_delay. 2015-06-30 15:57:15 +02:00
tile Use libc_hidden_proto / libc_hidden_def with __strnlen. 2015-06-02 20:24:25 +00:00
unix S390: Fix "backtrace() returns infinitely deep stack frames with makecontext()" [BZ #18508]. 2015-07-07 16:11:14 +02:00
wordsize-32 Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
wordsize-64 Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
x86 Do not create invalid pointers in C code of string functions. 2015-07-07 13:40:12 +02:00
x86_64 Add la_symbind32 to x86-64 audit tests 2015-07-07 06:09:29 -07:00