From: Florian Weimer <fweimer@redhat.com>
To: Carlos O'Donell <carlos@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v2] elf: Make more functions available for binding during dlclose (bug 30425)
Date: Thu, 25 May 2023 21:06:16 +0200 [thread overview]
Message-ID: <87wn0wi63b.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <b977747f-e5a2-1f42-e65e-ac944b51be43@redhat.com> (Carlos O'Donell's message of "Thu, 25 May 2023 14:57:28 -0400")
* Carlos O'Donell:
> On 5/22/23 07:32, Florian Weimer via Libc-alpha wrote:
>> Previously, after destructors for a DSO have been invoked, ld.so refused
>> to bind against that DSO in all cases. Relax this restriction somewhat
>> if the referencing object is itself a DSO that is being unloaded. This
>> assumes that the symbol reference is not going to be stored anywhere.
>
> The truth here is that the example has a circular reference due to the
> interposition which makes it have an undefined load and unload
> order. You wrote a very specific test that *avoids* needing anything
> from mod1 during mod2's initialization.
It's possible to create this situation with C++ code due to vague
linkage. No explicit interposition is needed. I didn't want to
incorporate the C++ test case because it's brittle: it depends on which
functions the compiler emits. (It has some leeway because of vague
linkage.)
> Having said all that we should *choose* an unload order that is the
> opposite of the load order and make it consistent, and if we could
> load it we should not fail to unload it because of a limitation of the
> dynamic loader. We might still fail due to some logical dependency in
> user code though.
>
> The DT_NEEDED in mod1 ensures we load: mod2 then mod1. The closing of
> mod1 should unload: mod1 then mod2 (opposite order).
>
> This consistent order should make it easier for users to debug other
> problems in their library designs.
Yeah, sure? But that's how it's always been?
>> The situation in the test case can arise fairly easily with C++ and
>> objects that are built with different optimization levels and therefore
>> define different functions with vague linkage.
>
> Please post a v3.
With the comment updates? Or some other changes?
Thanks,
Florian
next prev parent reply other threads:[~2023-05-25 19:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-22 11:32 Florian Weimer
2023-05-25 18:57 ` Carlos O'Donell
2023-05-25 19:06 ` Florian Weimer [this message]
2023-05-29 20:09 ` Carlos O'Donell
2023-05-30 8:59 ` Florian Weimer
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=87wn0wi63b.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=carlos@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).