This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug network/10652] getaddrinfo causes segfault if multithreaded and linked statically


https://sourceware.org/bugzilla/show_bug.cgi?id=10652

--- Comment #23 from Carlos O'Donell <carlos at redhat dot com> ---
(In reply to Rich Felker from comment #22)
> As long as libpthread is a separate DSO, avoiding loading it makes sense,
> yes. However it seems that all the internal locking in glibc components
> (including nss modules) could be done with lock functions available
> unconditionally in libc rather than needing the pthread lock functions. I'm
> not familiar enough with the glibc internals to know whether such functions
> are already available, but it would certainly make for a cleaner solution to
> this and many other problems if they are. Note that the locking requirements
> for internal use are much simpler than pthread requirements; there are no
> difficult issues like different mutex types, self-synchronized destruction,
> etc.

No, you make a good point, and internally glibc already uses just plain futexes
for __libc_lock_lock, but for non-libc modules like libnss_files.so.2 (loaded
as part of the NSS plugin mechanism) the __libc_lock_lock defines redirect to
__pthread_mutex_lock. I see no reason at the moment why they couldn't just use
futexes for serializing threaded access. There was certainly no futex support
when these NSS modules were written so it might be a legacy issue. Switching
them over to futex locking would solve this problem and the uncontended lock
case is an atomic operation that should always succeeds.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]