Subject: lib/26370: pthread_create fails in -current
To: None <gnats-bugs@gnats.NetBSD.org>
From: Martin Husemann <martin@duskware.de>
List: netbsd-bugs
Date: 07/19/2004 21:50:05
>Number:         26370
>Category:       lib
>Synopsis:       pthread_create fails in -current
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 19 19:52:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Martin Husemann
>Release:        NetBSD 2.0G
>Organization:
>Environment:
System: NetBSD night-owl.duskware.de 2.0G NetBSD 2.0G (REVEL) #16: Mon Jul 19 17:24:26 CEST 2004 martin@night-owl.duskware.de:/usr/src/sys/arch/i386/compile/REVEL i386
Architecture: i386
Machine: i386
>Description:

Running the following test program (from pkgsrc/devel/glib2's configure) dumps
core on -current:

--8<--
#include <pthread.h>

int check_me = 0;

void* func(void* data) {check_me = 42; return &check_me;}

int main()
 { pthread_t t;
   void *ret;
   pthread_create (&t, 0, func, 0);
   pthread_join (t, &ret);
   exit (check_me != 42 || ret != &check_me);
}
-->8--

gdb shows the main thread in pthread_create and the new LWP in
pthread__sched_idle():

Starting program: /tmp/conftest 

Program received signal SIGSEGV, Segmentation fault.
0x48067132 in pthread__sched_idle () from /usr/lib/libpthread.so.0
(gdb) bt
#0  0x48067132 in pthread__sched_idle () from /usr/lib/libpthread.so.0
#1  0x480692c3 in pthread_init () from /usr/lib/libpthread.so.0
#2  0x48069781 in pthread_create () from /usr/lib/libpthread.so.0
#3  0x08048852 in main () at conftest.c:10
#4  0x080485c2 in ___start ()

>How-To-Repeat:

compile and run above program on -current.

>Fix:
n/a
>Release-Note:
>Audit-Trail:
>Unformatted: