Many core dumps in pthread_getspecific - how to debug?

Erich Dollansky erichsfreebsdlist at alogt.com
Wed Jun 3 21:44:24 UTC 2015


Hi,

On Wed, 3 Jun 2015 13:09:39 +0200
"Andre Meiser" <ortadur at web.de> wrote:

> On Wed, 3 Jun 2015 10:47 +0200 Erich Dollansky wrote:
> > Can you get the sources and compile your own FreeBSD?
> 
> I got the source from here:
> http://svnweb.freebsd.org/base/releng/10.1/
> 
this is a good source.

> And in lib/libkse/thread/thr_spec.c line 211-214 I found this:
> 
>     pthread = _get_curthread();
> 
>     /* Check if there is specific data: */
>     if (pthread->specific != NULL && (unsigned int)key <
> PTHREAD_KEYS_MAX) {
> 
> If pthread is NULL than this will crash with a core dump. So I made a
> quick grep about the sources and at other places the return value of
> _get_curthread() is compared with NULL, e.g. thr_kern.c in line 601:
> 
>     if ((crit != NULL) && ((curthread = _get_curthread()) != NULL))
> 
> It looks like _get_curthread() may return NULL and than thr_spec.c
> line 214 has to look like this:
> 
>     if (pthread != NULL && pthread->specific != NULL && (unsigned
> int)key < PTHREAD_KEYS_MAX) {
> 
> But I'm new to FreeBSD, so I'm not sure if this will help to fix the
> problem. And I'm not experienced enough to compile my own FreeBSD,
> yet.

You might be the person with the least experience and the shortest time
between start and finding the first error.

I would suggest that you file a bug report under:

https://bugs.freebsd.org/bugzilla/enter_bug.cgi

Include your fix as a diff.

Ok, still, I run FreeBSD since decades and never came across this
problem. So, you must have another problem on your machine.

Erich
> 
> 
> > Try first the source. The best mailing list for this should be
> > 'stable' as it targets only the stable versions like yours.
> 
> Ok, thanks, I'll write it there, too.
> 
> Sincerely yours Andre.
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe at freebsd.org"



More information about the freebsd-questions mailing list