aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--nptl/tst-cancel17.c16
2 files changed, 20 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index a191caff00..95de597034 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016-05-17 Stefan Liebler <stli@linux.vnet.ibm.com>
+
+ * nptl/tst-cancel17.c (do_test): Wait for finishing aio_read(&a).
+
2016-05-13 Florian Weimer <fweimer@redhat.com>
Fix race condition in tst-mallocfork2, use fewer resources.
diff --git a/nptl/tst-cancel17.c b/nptl/tst-cancel17.c
index fb89292070..eedd28e792 100644
--- a/nptl/tst-cancel17.c
+++ b/nptl/tst-cancel17.c
@@ -333,6 +333,22 @@ do_test (void)
puts ("early cancellation succeeded");
+ if (ap == &a2)
+ {
+ /* 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 either has already been finished or
+ is able to read the requested byte.
+ Wait for the read request before returning from this function because
+ the return value and error code from the read syscall will be written
+ to the struct aiocb a, which lies on the stack of this function.
+ Otherwise the stack from subsequent function calls - e.g. _dl_fini -
+ will be corrupted, which can lead to undefined behaviour like a
+ segmentation fault. */
+ const struct aiocb *l[1] = { &a };
+ TEMP_FAILURE_RETRY (aio_suspend(l, 1, NULL));
+ }
+
return 0;
}