about summary refs log tree commit diff
path: root/stdlib/Makefile
diff options
context:
space:
mode:
authorCarlos O'Donell <carlos@systemhalted.org>2015-05-08 11:20:32 -0400
committerCarlos O'Donell <carlos@systemhalted.org>2015-05-08 11:29:38 -0400
commitc92d40c0bcfdeec96848d1e67902e621942144e9 (patch)
treef1b3c606c16ed474b0a5b871c4fc5ea32315a210 /stdlib/Makefile
parenta6d78c3b9dc9bf598a60be18e23bf8fe7668a088 (diff)
downloadglibc-c92d40c0bcfdeec96848d1e67902e621942144e9.tar.gz
glibc-c92d40c0bcfdeec96848d1e67902e621942144e9.tar.xz
glibc-c92d40c0bcfdeec96848d1e67902e621942144e9.zip
Bug 18125: Call exit after last linked context.
There appears to be a discrepancy among the implementations
of setcontext with regards to the function called once the last
linked-to context has finished executing via setcontext.

The POSIX standard says:
~~~
If the uc_link member of the ucontext_t structure pointed to by
the ucp argument is equal to 0, then this context is the main
context, and the thread will exit when this context returns.
~~~

It says "exit" not "exit immediately" nor "exit without running
functions registered with atexit or on_exit."

Therefore the AArch64, ARM, hppa and NIOS II implementations are
wrong and no test detects it.

It is questionable if this should even be fixed or just documented
that the above 4 targets are wrong. The functions are deprecated
and nobody should be using them, but at the same time it silly to
have cross-target differences that make it hard to port old
applications from say x86_64 to AArch64.

Therefore I will ix the 4 arches, and checkin a regression
test to prevent it from changing again.

https://sourceware.org/ml/libc-alpha/2015-03/msg00720.html
Diffstat (limited to 'stdlib/Makefile')
-rw-r--r--stdlib/Makefile9
1 files changed, 8 insertions, 1 deletions
diff --git a/stdlib/Makefile b/stdlib/Makefile
index c78fdb51ec..3300dd2142 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -73,7 +73,8 @@ tests		:= tst-strtol tst-strtod testmb testrand testsort testdiv   \
 		   tst-qsort2 tst-makecontext2 tst-strtod6 tst-unsetenv1    \
 		   tst-makecontext3 bug-getcontext bug-fmtmsg1		    \
 		   tst-secure-getenv tst-strtod-overflow tst-strtod-round   \
-		   tst-tininess tst-strtod-underflow tst-tls-atexit
+		   tst-tininess tst-strtod-underflow tst-tls-atexit	    \
+		   tst-setcontext3
 tests-static	:= tst-secure-getenv
 
 modules-names	= tst-tls-atexit-lib
@@ -157,3 +158,9 @@ tst-tls-atexit-lib.so-no-z-defs = yes
 
 $(objpfx)tst-tls-atexit: $(shared-thread-library) $(libdl)
 $(objpfx)tst-tls-atexit.out: $(objpfx)tst-tls-atexit-lib.so
+
+$(objpfx)tst-setcontext3.out: tst-setcontext3.sh $(objpfx)tst-setcontext3
+	$(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
+		 '$(run-program-env)' '$(test-program-prefix-after-env)' \
+		 $(common-objpfx)stdlib/; \
+	$(evaluate-test)