From: Mike Frysinger <vapier@gentoo.org>
To: libc-alpha@sourceware.org
Cc: "Ondřej Bílka" <neleai@seznam.cz>, libc-ports@sourceware.org
Subject: Re: [RFC][BZ #1874] Fix assertion triggered by thread/fork interaction
Date: Thu, 02 Jan 2014 22:18:00 -0000 [thread overview]
Message-ID: <201401021718.23793.vapier@gentoo.org> (raw)
In-Reply-To: <20131009200534.GA4300@domone.podge>
[-- Attachment #1: Type: Text/Plain, Size: 1426 bytes --]
On Wednesday 09 October 2013 16:05:34 Ondřej Bílka wrote:
> Details:
>
> If a thread happens to hold dl_load_lock and have r_state set to RT_ADD
> or RT_DELETE at the time another thread calls fork(), then the child exit
> code from fork (in nptl/sysdeps/unix/sysv/linux/fork.c in our case)
> re-initializes dl_load_lock but does not restore r_state to RT_CONSISTENT.
> If the child subsequently requires ld.so functionality before calling
> exec(), then the assertion will fire.
>
> The patch acquires dl_load_lock on entry to fork() and releases it on exit
> from the parent path. The child path is initialized as currently done.
> This is essentially pthreads_atfork, but forced to be first because the
> acquisition of dl_load_lock must happen before malloc_atfork is active
> to avoid a deadlock.
> "
doesn't seem right that we grab the lock and then just reset it in the child ?
seems like you should just unlock it rather than reset it in the child.
i'm also wary of code that already grabs a lot of locks trying to grab even
more. the code paths that already grab the IO locks ... can they possibly
grab this one too ? like a custom format handler that triggers loading of
libs ?
> + /* grab ld.so lock BEFORE switching to malloc_atfork */
comment style is incorrect
> + /* unlock ld.so last, because we locked it first */
comment style is wrong here too
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2014-01-02 22:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-09 20:05 Ondřej Bílka
2013-10-17 15:41 ` Ondřej Bílka
2014-01-02 20:30 ` [PING][RFC][BZ " Ondřej Bílka
2014-01-02 22:18 ` Mike Frysinger [this message]
2014-01-02 23:54 ` [RFC][BZ " Ondřej Bílka
2014-01-03 2:07 ` Mike Frysinger
2014-01-11 12:07 ` Ondřej Bílka
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=201401021718.23793.vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=libc-alpha@sourceware.org \
--cc=libc-ports@sourceware.org \
--cc=neleai@seznam.cz \
/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).