about summary refs log tree commit diff
path: root/debug/tst-backtrace5.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.com>2015-09-21 15:55:58 -0700
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-01-03 18:38:09 -0200
commitd0d7f85f66a19c3110d550c3c24247f7b4f2c58a (patch)
tree1e5707d171b1c6ca7c911e37c78d3b7bbc341dce /debug/tst-backtrace5.c
parent17cc27d5b7e74fe92db11caf989b941c1fd0d9f7 (diff)
downloadglibc-d0d7f85f66a19c3110d550c3c24247f7b4f2c58a.tar.gz
glibc-d0d7f85f66a19c3110d550c3c24247f7b4f2c58a.tar.xz
glibc-d0d7f85f66a19c3110d550c3c24247f7b4f2c58a.zip
nptl: Fix testcases for new pthread cancellation mechanism
With upcoming fix for BZ#12683, pthread cancellation does not act for:

  1. If syscall is blocked but with some side effects already having
     taken place (e.g. a partial read or write).
  2. After the syscall has returned.

The main change is due the fact programs need to act in syscalls with
side-effects (for instance, to avoid leak of allocated resources or
handle partial read/write).

This patch changes the NPTL testcase that assumes the old behavior and
also changes the tst-backtrace{5,6} to ignore the cancellable wrappers.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu,
powerpc-linux-gnu, sparcv9-linux-gnu, and sparc64-linux-gnu.

	* debug/tst-backtrace5.c (handle_signal): Avoid cancellable wrappers
	in backtrace analysis.
	* nptl/tst-cancel4.c (tf_write): Handle cancelled syscall with
	side-effects.
	(tf_send): Likewise.
Diffstat (limited to 'debug/tst-backtrace5.c')
-rw-r--r--debug/tst-backtrace5.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/debug/tst-backtrace5.c b/debug/tst-backtrace5.c
index dfbe4c1912..5a5ce8bc79 100644
--- a/debug/tst-backtrace5.c
+++ b/debug/tst-backtrace5.c
@@ -69,17 +69,18 @@ handle_signal (int signum)
       FAIL ();
       return;
     }
-  /* Do not check name for signal trampoline.  */
-  i = 2;
-  if (!match (symbols[i++], "read"))
+
+  /* Do not check name for signal trampoline or cancellable syscall
+     wrappers (__syscall_cancel*).  */
+  for (; i < n - 1; i++)
+    if (match (symbols[i], "read"))
+      break;
+  if (i == n - 1)
     {
-      /* Perhaps symbols[2] is __kernel_vsyscall?  */
-      if (!match (symbols[i++], "read"))
-	{
-	  FAIL ();
-	  return;
-	}
+      FAIL ();
+      return;
     }
+
   for (; i < n - 1; i++)
     if (!match (symbols[i], "fn"))
       {