[PATCH] LT.old: Make errno_location thread safe

Peter Korsgaard peter at korsgaard.com
Wed Mar 12 14:12:18 UTC 2014


>>>>> "Vineet" == Vineet Gupta <Vineet.Gupta1 at synopsys.com> writes:

 > [summary: Get rid of libc alias __GI___errno_location]
 > It seems with Linuxthreads.old (yet to confirm NPTL) errno is not thread
 > safe.

 > A simple pthread linked test program (at the bottom) which makes a
 > failing syscall e.g. open("/not-exist") fails to observe the right errno
 > in the thread (main is OK)

 > Conceptually uClibc defines weak __errno_location() while libpthread
 > defines astrong variant. This arrangement shd work when using -pthread
 > links. The spoil sport is __GI___errno_location, intended to bypass PLT
 > for intra-libc callers. It gets called even in case of LT.old links
 > given the syscall wrappers in  libpthread (LT.old). e.g.

 > open [ in libpthread ]
 >   pthreadsetcanceltype()
 >    __libc_open()
 >       __GI__open()
 >            ...
 > -           __GI___errno_location    [ existing ]
 > +           __errno_location         [ intended ]
 >    ....
 >   pthreadsetcanceltype()

 > So the solution is to get rid of GI alias for errno_location
 > altogether.

That sounds pretty much like:

http://lists.uclibc.org/pipermail/uclibc/2010-July/044176.html

Which afaik never got committed.

-- 
Bye, Peter Korsgaard


More information about the uClibc mailing list