TLS(and by extension all threading) completely broken in
Valgrind on i386/amd64
Stanislav Sedov
stas at FreeBSD.org
Fri Feb 26 23:21:42 UTC 2010
On Sun, 7 Feb 2010 14:06:18 -0500
Ryan Stone <rysto32 at gmail.com> mentioned:
> I've been trying out valgrind on some threaded FreeBSD applications
> but they've been deadlocking at startup. I've identified that the
> root cause is that FreeBSD's thread local storage is not being
> emulated properly by valgrind. The problem on amd64 is obvious:
> valgrind gives an invalid opcode error when the program tries to
> execute any instruction that accesses the gs register. On i386 the
> problem is much more subtle.
>
> I've attached two test applications that demonstrate the problem. In
> pthread_self.c, I create one thread which periodically prints
> pthread_self(), and then 10 seconds later I create a second thread.
> After the second thread is created, the first thread believes that it
> is the second thread. Here's an example invocation:
>
Thank you a lot for the information, I'll try to look into this soon and
will followup in detail.
Sorry for delay in replying.
--
Stanislav Sedov
ST4096-RIPE
More information about the freebsd-ports
mailing list