Commit Graph

13 Commits

Author SHA1 Message Date
Stefan Liebler b3a810d0d3 Fix tst-cancel17/tst-cancelx17, which sometimes segfaults while exiting.
The testcase tst-cancel[x]17 ends sometimes with a segmentation fault.
This happens in one of 10000 cases. Then the real testcase has already
exited with success and returned from do_test(). The segmentation fault
occurs after returning from main in _dl_fini().

In those cases, the aio_read(&a) was not canceled because the read
request was already in progress. In the meanwhile aio_write(ap) wrote
something to the pipe and the read request is able to read the
requested byte.
The read request hasn't finished before returning from do_test().
After it finishes, it writes the return value and error code from the
read syscall to the struct aiocb a, which lies on the stack of do_test.
The stack of the subsequent function call of _dl_fini or _dl_sort_fini,
which is inlined in _dl_fini is corrupted.

In case of S390, it reads a zero and decrements it by 1:
unsigned int k = nmaps - 1;
struct link_map **runp = maps[k]->l_initfini;
The load from unmapped memory leads to the segmentation fault.
The stack corruption also happens on other architectures.
I saw them e.g. on x86 and ppc, too.

This patch adds an aio_suspend call to ensure, that the read request
is finished before returning from do_test().

ChangeLog:

	* nptl/tst-cancel17.c (do_test): Wait for finishing aio_read(&a).
2016-05-17 10:45:48 +02:00
Joseph Myers f7a9f785e5 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Joseph Myers b168057aaa Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Allan McRae d4697bc93d Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
Joseph Myers 568035b787 Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
Paul Eggert 59ba27a63a Replace FSF snail mail address with URLs. 2012-02-09 23:18:22 +00:00
Ulrich Drepper 6bdfb89a67 (do_test): Add arbitrary factor to make sure aio_write blocks. 2005-04-27 08:20:41 +00:00
Ulrich Drepper a334319f65 (CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4. 2004-12-22 20:10:10 +00:00
Jakub Jelinek 0ecb606cb6 2.5-18.1 2007-07-12 18:26:36 +00:00
Ulrich Drepper a30fb2df74 Update.
2003-08-06  Jakub Jelinek  <jakub@redhat.com>

	* tst-cancel17.c (do_test): Make len2 maximum of page size and
	PIPE_BUF.
2003-08-08 07:11:21 +00:00
Ulrich Drepper 7b787f8516 Update.
2003-07-24  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/pthread/aio_cancel.c (aio_cancel): Return AIO_ALLDONE
	if aiocbp != NULL and has already completed.  Return -1/EINVAL if
	aiocbp->aio_fildes does not match fildes.
2003-07-25 07:56:33 +00:00
Ulrich Drepper 67b78ef91b Update.
* sysdeps/pthread/aio_misc.h: Mark __aio_requests_mutex,
	__aio_enqueue_request, __aio_find_req, __aio_find_req_fd,
	__aio_free_request, __aio_notify, and __aio_sigqueue as hidden.

	* sysdeps/pthread/aio_suspend.c (aio_suspend): Set errno to the result
	of pthread_cond_wait if there was an error.  Use pthread_cleanup_*
	instead of __lbic_cleanup_region_*.
2003-06-24 02:50:16 +00:00
Ulrich Drepper 60d73a7ac4 Update.
* sysdeps/unix/clock_nanosleep.c (clock_nanosleep): nanosleep
	takes care of enabling cancellation.

	* sysdeps/pthread/aio_suspend.c (aio_suspend): Make aio_suspend
	cancelable.  It's not correct to disable cancellation.  Instead of
	a cleanup handler.
2003-06-17 22:11:22 +00:00