public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fweimer at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug dynamic-link/28937] New DSO dependency sorter does not put new map first if in a cycle
Date: Mon, 15 Aug 2022 09:23:51 +0000	[thread overview]
Message-ID: <bug-28937-131-XMJ3QndSZr@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-28937-131@http.sourceware.org/bugzilla/>

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|New DSO dependency resolver |New DSO dependency sorter
                   |buggyness with dlclose()    |does not put new map first
                   |                            |if in a cycle
           Assignee|unassigned at sourceware dot org   |fweimer at redhat dot com
              Flags|                            |security-
             Status|WAITING                     |ASSIGNED

--- Comment #9 from Florian Weimer <fweimer at redhat dot com> ---
I could get it to boot in UEFI mode, but the disk has to be attached as sata
(not virtio). Thank you for putting together this reproducer, it is really
helpful.

The situation matches the one described in comment 0. There is no dlclose call
for libfreetype.so.6, so libbz2.so.1.0 really can't been unloaded.

A comment in _dl_close_worker alludes to the root cause:

          /* We are always the zeroth entry, and since we don't include
             ourselves in the dependency analysis start at 1.  */
          struct link_map **lp = &l->l_initfini[1];

The assumption is not correct in this case, l_initfini[0] is actually
libbz2.so.1.0 here. The reason is that the new algorithm does not implement
skipping, and due to the cyclic dependency between libfreetype.so.6 and
libharfbuzz.so.0, libfreetype.so.6 is not sorted first naturally.

I think it makes sense to always initialize the newly-loaded object first, but
as the comment in _dl_sort_maps_dfs explains, that algorithm cannot skip the
dependencies directly. But I think we should adjsut _dl_sort_maps_dfs because
the initialization order property seems useful. I'll try to come up with a
patch.

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

  parent reply	other threads:[~2022-08-15  9:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03 12:48 [Bug dynamic-link/28937] New: New DSO dependency resolver buggyness with dlclose() pieterjan.briers at gmail dot com
2022-03-03 15:08 ` [Bug dynamic-link/28937] " fweimer at redhat dot com
2022-03-03 15:27 ` fweimer at redhat dot com
2022-03-03 22:55 ` pieterjan.briers at gmail dot com
2022-03-03 23:25 ` pieterjan.briers at gmail dot com
2022-03-04  1:07 ` pieterjan.briers at gmail dot com
2022-03-11 19:24 ` freswa at archlinux dot org
2022-04-11 23:19 ` woodard at redhat dot com
2022-04-12 10:29 ` fweimer at redhat dot com
2022-08-08 10:38 ` fweimer at redhat dot com
2022-08-08 19:59 ` sam at gentoo dot org
2022-08-14 20:06 ` pieterjan.briers at gmail dot com
2022-08-15  9:23 ` fweimer at redhat dot com [this message]
2022-09-20  9:07 ` [Bug dynamic-link/28937] New DSO dependency sorter does not put new map first if in a cycle fweimer at redhat dot com
2022-09-21  9:17 ` fweimer at redhat dot com
2023-08-22 10:49 ` fweimer at redhat dot com

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-28937-131-XMJ3QndSZr@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).