This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

More problems with tst-cancel17


We enable cancellation in a couple of places before waiting on a lock, or on
a tid.  So lowlevellock.c needs exceptions.  The assembly versions of it
also do, but I didn't try to hand-write the CFI for SH, i386, or x86_64.

aio_suspend is a cancellation point but there's a path through it that never
checks for cancellation.

Are these changes OK?

Both of these were found while debugging tst-cancel17.  It turns out the
test is broken under very recent kernels, because in Linus's rewritten pipe
implementation, the write to a pipe will not block.  There's no clear size
that you can use to make sure you block, either.  I'm not sure how to force
aio_write to block reliably now.  On MIPS, the above two patches "fix" the
early cancellation of tf, but not of tf2.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

2005-02-12  Daniel Jacobowitz  <dan@codesourcery.com>

	* Makefile: Use -fexceptions -fasynchronous-unwind-tables for
	lowlevellock.c.

2005-02-12  Daniel Jacobowitz  <dan@codesourcery.com>

	* sysdeps/pthread/aio_suspend.c (aio_suspend): Always check
	for cancellation.

Index: glibc/nptl/Makefile
===================================================================
--- glibc.orig/nptl/Makefile	2005-01-07 15:26:10.000000000 -0500
+++ glibc/nptl/Makefile	2005-02-11 20:03:18.045670097 -0500
@@ -156,6 +156,10 @@ CFLAGS-pthread_exit.c = -fexceptions
 # exceptions.
 CFLAGS-forward.c = -fexceptions
 
+# These functions can block and may be called while cancellation is
+# enabled, so compile any C version with exceptions.
+CFLAGS-lowlevellock.c = -fexceptions -fasynchronous-unwind-tables
+
 # The following are cancellation points.  Some of the functions can
 # block and therefore temporarily enable asynchronous cancellation.
 # Those must be compiled asynchronous unwind tables.
Index: glibc/sysdeps/pthread/aio_suspend.c
===================================================================
--- glibc.orig/sysdeps/pthread/aio_suspend.c	2003-09-05 12:48:44.000000000 -0400
+++ glibc/sysdeps/pthread/aio_suspend.c	2005-02-11 22:51:46.172949106 -0500
@@ -169,6 +169,9 @@ aio_suspend (list, nent, timeout)
 
       pthread_cleanup_pop (0);
     }
+  else
+    /* aio_suspend is a cancellation point.  Make sure we check for it.  */
+    pthread_testcancel ();
 
   /* Now remove the entry in the waiting list for all requests
      which didn't terminate.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]