public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: libc-alpha@sourceware.org
Subject: Re: [review v3] Remove all loaded objects if dlopen fails, ignoring NODELETE [BZ #20839]
Date: Mon, 02 Dec 2019 16:07:00 -0000	[thread overview]
Message-ID: <871rtmyams.fsf@oldenburg2.str.redhat.com> (raw)
In-Reply-To: <20191115160205.9EEC928171@gnutoolchain-gerrit.osci.io> (Florian Weimer's message of "Fri, 15 Nov 2019 11:02:04 -0500")

* Florian Weimer:

> +/* Mark the objects as NODELETE if required.  This is delayed until
> +   after dlopen failure is not possible, so that _dl_close can clean
> +   up objects if necessary.  */
> +static void
> +activate_nodelete (struct link_map *new, int mode)
> +{
> +  if (mode & RTLD_NODELETE || new->l_nodelete == link_map_nodelete_pending)
> +    {
> +      if (__glibc_unlikely (GLRO (dl_debug_mask) & DL_DEBUG_FILES))
> +	_dl_debug_printf ("activating NODELETE for %s [%lu]\n",
> +			  new->l_name, new->l_ns);
> +      new->l_nodelete = link_map_nodelete_active;
> +    }
> +
> +  for (unsigned int i = 0; i < new->l_searchlist.r_nlist; ++i)
> +    {
> +      struct link_map *imap = new->l_searchlist.r_list[i];
> +      if (imap->l_nodelete == link_map_nodelete_pending)
> +	{
> +	  if (__glibc_unlikely (GLRO (dl_debug_mask) & DL_DEBUG_FILES))
> +	    _dl_debug_printf ("activating NODELETE for %s [%lu]\n",
> +			      imap->l_name, imap->l_ns);
> +
> +	  /* Only new objects should have set
> +	     link_map_nodelete_pending.  Existing objects should not
> +	     have gained any new dependencies and therefore cannot
> +	     reach NODELETE status.  */
> +	  assert (!imap->l_init_called || imap->l_type != lt_loaded);

This assert is incorrect because the NODELETE markers actually go in the
other direction (from new loaded libraries to their dependencies).

I still need to write tests for this.  But I can submit a patch for the
removal of the assert immediately, if so desired.

Thanks,
Florian

  reply	other threads:[~2019-12-02 16:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-31 19:21 [review] " Florian Weimer (Code Review)
2019-10-31 20:18 ` Christian Häggström (Code Review)
2019-11-13 12:56 ` [review v2] " Florian Weimer (Code Review)
2019-11-13 14:28 ` Christian Häggström (Code Review)
2019-11-15 16:02 ` [review v3] " Florian Weimer (Code Review)
2019-12-02 16:07   ` Florian Weimer [this message]
2019-12-02 16:53     ` Carlos O'Donell
2019-11-21 12:57 ` Carlos O'Donell (Code Review)
2019-11-27 20:31 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-12-02 10:07   ` Szabolcs Nagy
2019-12-02 12:17     ` Florian Weimer
2019-12-02 13:52       ` Szabolcs Nagy

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=871rtmyams.fsf@oldenburg2.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@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).