public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "carlos at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug network/10652] getaddrinfo causes segfault if multithreaded and linked statically
Date: Wed, 27 Nov 2013 05:29:00 -0000	[thread overview]
Message-ID: <bug-10652-131-6FEXOWef7V@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-10652-131@http.sourceware.org/bugzilla/>

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.


  parent reply	other threads:[~2013-11-27  5:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-10652-131@http.sourceware.org/bugzilla/>
2011-03-26  7:10 ` [Bug libc/10652] " bobby at sharedrealm dot com
2011-03-26  7:15 ` bobby at sharedrealm dot com
2011-03-26  7:24 ` bobby at sharedrealm dot com
2011-03-26  7:36 ` bobby at sharedrealm dot com
2011-03-26  7:58 ` bobby at sharedrealm dot com
2012-02-21  1:57 ` [Bug stdio/10652] " jsm28 at gcc dot gnu.org
2013-01-03 12:14 ` aj at suse dot de
2013-10-08 15:05 ` [Bug network/10652] " neleai at seznam dot cz
2013-11-25  5:22 ` carlos at redhat dot com
2013-11-26 23:02 ` carlos at redhat dot com
2013-11-27  3:05 ` bugdal at aerifal dot cx
2013-11-27  5:04 ` carlos at redhat dot com
2013-11-27  5:19 ` bugdal at aerifal dot cx
2013-11-27  5:29 ` carlos at redhat dot com [this message]
2014-02-16 17:47 ` jackie.rosen at hushmail dot com
2014-05-28 19:43 ` schwab at sourceware dot org
2014-07-01  6:50 ` fweimer at redhat dot com
2020-06-21 15:57 ` izbyshev at ispras dot ru

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-10652-131-6FEXOWef7V@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).