[PATCH] dlsym: Make RTLD_NEXT prefer default version definition [#BZ #14932]
Fāng-ruì Sòng
maskray@google.com
Sun May 22 18:54:28 GMT 2022
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.
More information about the Libc-alpha
mailing list