This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: dlinfo for the calling shared library


On 7/10/19 10:15 AM, Florian Weimer wrote:
* Zack Weinberg:

Do we have a supported way to make dlinfo() queries for the shared
library from which the call originates, without the library having to
know its own soname?  (If it knows its own soname, it can call dlopen
on itself, but I'm looking into a scenario where that information is
not available.)

dladdr1 with RTLD_DL_LINKMAP returns the link map, which has a public
l_name member in <link.h>.  If you do not want to use the handle/link
map equivalence, you could dlopen l_name, and that should give you back
the same handle in an official way.

What happens if l_name is different on disk now and has a distinct SONAME?
Doesn't this introduce a race condition?

If you open by SONAME then you should always get the already loaded in-memory
object which might have changed from the on-disk contents.

--
Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]