From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: "Fāng-ruì Sòng" <maskray@google.com>,
"Florian Weimer" <fw@deneb.enyo.de>
Cc: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [PATCH] dlsym: Make RTLD_NEXT prefer default version definition [#BZ #14932]
Date: Fri, 27 May 2022 13:59:43 -0300 [thread overview]
Message-ID: <49ca6122-ca7a-d384-79e3-9bdc02879a94@linaro.org> (raw)
In-Reply-To: <CAFP8O3J9RAg59drw-PqFW9qQ+eXngxyTssoZk8NKZz11uZyPbA@mail.gmail.com>
On 22/05/2022 15:54, Fāng-ruì Sòng wrote:
> On Fri, May 20, 2022 at 7:22 AM Florian Weimer <fw@deneb.enyo.de> wrote:
>>
>> * Adhemerval Zanella via Libc-alpha:
>>
>>> On 20/05/2022 05:35, Fangrui Song via Libc-alpha wrote:
>>>> When the first object providing foo defines both foo@v1 and foo@@v2,
>>>> dlsym(RTLD_NEXT, "foo") returns foo@v1 while dlsym(RTLD_DEFAULT, "foo")
>>>> returns foo@@v2. The issue is that RTLD_DEFAULT use the
>>>> DL_LOOKUP_RETURN_NEWEST flag while RTLD_NEXT doesn't. Fix the RTLD_NEXT
>>>> branch to use DL_LOOKUP_RETURN_NEWEST.
>>>
>>> I am afraid we will need to add a compat dlsym for this change.
>>
>> My working theory is dlsym with RTLD_NEXT with a versioned symbol is
>> so buggy that this is not needed. I want to understand the nature of
>> the bug, and plan to post a write-up.
>
> Ok, thanks.
>
> FWIW: I have verified that on FreeBSD 13.1, both dlsym(RTLD_NEXT,
> "foo") and dlsym(RTLD_DEFAULT, "foo") resolve to the default version
> definition, like what this patch does.
Right, I agree this is the most reasonable way to handle RTLD_NEXT with
versioned symbols specially because current semantic is to return the
*oldest* version with not apparent reason. I guess that if caller wants
an old version it can use dlvsym with the appropriated version.
LGTM as well with Florian's remarks fixed.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
next prev parent reply other threads:[~2022-05-27 16:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-20 8:35 Fangrui Song
2022-05-20 11:27 ` Adhemerval Zanella
2022-05-20 14:22 ` Florian Weimer
2022-05-22 18:54 ` Fāng-ruì Sòng
2022-05-27 16:59 ` Adhemerval Zanella [this message]
2022-05-27 11:03 ` Florian Weimer
2022-05-27 19:24 ` Fangrui Song
2022-05-27 20:32 ` Fangrui Song
2022-05-27 20:38 ` Florian Weimer
2022-05-27 21:03 ` Fangrui Song
2022-05-27 21:15 ` Adhemerval Zanella
2022-05-27 22:04 ` Fangrui Song
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=49ca6122-ca7a-d384-79e3-9bdc02879a94@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=fw@deneb.enyo.de \
--cc=libc-alpha@sourceware.org \
--cc=maskray@google.com \
/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).