bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: assertion failure in the glibc


From: Samuel Thibault
Subject: Re: assertion failure in the glibc
Date: Wed, 27 Aug 2014 21:53:39 +0200
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Hello,

Justus Winter, le Mon 05 May 2014 14:10:48 +0200, a écrit :
> I believe I have found two problems in the glibc.
> 
> 1. hurd_check_cancel takes 'lock', and then asserts that
>    'critical_section_lock' is not taken.  However, hurd_thread_cancel
>    first takes 'critical_section_lock' and then 'lock'.  This program
>    demonstrates this by spinning on both functions.

Indeed, it's another instance of the issue worked around in
t/thread-cancel. Roland, this is the reproducer you were asking for in 

http://lists.gnu.org/archive/html/bug-hurd/2006-08/msg00019.html

> 2. The assertion failure actually deadlocks trying to write the
>    message.

Yes, that is not surprising since the assertion is inside a ss->lock
section, which _hurd_ctty_output will want to take.

Thanks for 
Samuel

> #include <mach.h>
> #include <stdio.h>
> #include <pthread.h>
> 
> thread_t thread;
> 
> static void *
> thread_start(void *arg)
> {
>   thread = mach_thread_self ();
>   while (1) hurd_check_cancel ();
>   return NULL;
> }
> 
> int
> main(int argc, char *argv[])
> {
>   pthread_t pthread;
>   int s;
>   s = pthread_create(&pthread, NULL, &thread_start, NULL);
>   if (s != 0) return 1;
> 
>   while (thread == 0) /* didum */;
>   printf ("spinning on hurd_thread_cancel (%d)\n", thread);
>   while (1) hurd_thread_cancel (thread);
>   return 0;
> }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]