Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Apr 2025 22:00:15 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Andriy Gapon <avg@freebsd.org>
Cc:        FreeBSD Current <current@freebsd.org>
Subject:   Re: RTLD_DEEPBIND question
Message-ID:  <aAk4v8QmQBB4FaM5@kib.kiev.ua>
In-Reply-To: <ced7398c-6523-4382-8cd0-42b8ecb856bd@freebsd.org>
References:  <0b3dda4e-53e4-40e5-9484-8b5ffb84e658@FreeBSD.org> <aALjHwFnFKChuAdR@kib.kiev.ua> <900c8521-559a-47b5-acaa-ae941f6852c4@freebsd.org> <fd12cce4-7e6b-4ab6-bced-b36e98c995ba@FreeBSD.org> <7c4e1682-d797-493c-8326-08d51dde3359@FreeBSD.org> <aAN69URjEJFuOLxR@kib.kiev.ua> <ced7398c-6523-4382-8cd0-42b8ecb856bd@freebsd.org>

index | next in thread | previous in thread | raw e-mail

On Wed, Apr 23, 2025 at 09:09:56PM +0300, Andriy Gapon wrote:
> On 19/04/2025 13:29, Konstantin Belousov wrote:
> > On Sat, Apr 19, 2025 at 01:25:28PM +0300, Andriy Gapon wrote:
> > > On 19/04/2025 12:39, Andriy Gapon wrote:
> > > >   From a quick look at the code, should we try to resolve the symbol in
> > > > refobj itself when it's marked with deepbind?
> > > Oh, and it looks like objects loaded under the "deepbind" object (e.g.,
> > > needed objects) may not be aware that they are in the deepbind sub-tree?
> > 
> > But should they?
> 
> That's a right question.
> 
> I have been reading about RTLD_DEEPBIND and Solaris flags like RTLD_GROUP,
> etc at the same time.  I guess that's why some things got "fused" in my
> mind.  So, I started believing that the concept of shared object dependency
> groups also applies to RTLD_DEEPBIND.
> 
> But that's not documented to be so, at least, in the documentation that I
> could find.  There are some in-depth documentation on Solaris run-time
> linker and its handling of various options.  But for Linux RTLD_DEEPBIND I
> could find only manual page references and they only say that deep-binding
> applies to to the object being dlopen-ed.
> 
> I am not sure if that's how the option actually works on Linux.
> I allow for possibility that the manual pages omit (or, at least, do not
> spell out) some details for brevity.
> 
> In any case, I believe that the proposed patch is correct.
> But I think that it would not help in my case.
> I have: mdb -[dlopen]-> dtrace.so -[needs]-> libdtrace.so.
> And it's a symbol in libdtrace.so that gets resolved to mdb instead of
> libdtrace.so itself.
> The patch would affect how symbols in dtrace.so are resolved if I understand
> correctly.
Well, it would also affect libdtrace.so, starting the resolution from
libdtrace, then falling back to the global list.

It might be that RTLD_GROUP is something you need, assuming that for
dependencies, resolution should go into the first dso in group.


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?aAk4v8QmQBB4FaM5>