[Gábor Gombás] Bug#564566: libkadm5clnt7: SONAME conflict with Heimdal

Tom Yu tlyu at mit.edu
Mon Jan 11 13:18:45 EST 2010

Nicolas Williams <Nicolas.Williams at sun.com> writes:

> On Mon, Jan 11, 2010 at 12:24:54PM -0500, Tom Yu wrote:
>> Luke Howard <lukeh at padl.com> writes:
>> > On 11/01/2010, at 5:58 PM, Nicolas Williams wrote:
>> >> Provided the libraries have different install locations, programs
>> >> properly use rpath, and that the Heimdal and MIT libraries need never be
>> >> loaded in the same process at once, then SONAME conflicts are not a
>> >> problem.
>> >> 
>> >> However, with plug-in interfaces galore it's very likely that both will
>> >> be loaded in the same process at some point.
>> >
>> > Right, but RTLD_LOCAL should be used (HDBBridge uses this to have Heimdal and MIT libraries in the KDC).
>> How well do various platforms cope with maintaining isolation between
>> shared libraries having the same SONAME but different contents?  If
>> the libraries with identical SONAMEs are run-time loaded with
>> RTLD_LOCAL and RTLD_GROUP?  If they are link-time dependencies of
>> intermediate libraries?  (Does Linux support RTLD_GROUP yet?)
> I believe the Solaris RTLD indexes a running process' link map by
> SONAME.  If two objects have the same SONAME then only one will be
> loaded, regardless of -B group/local or RTLD_GROUP/LOCAL use.

So the RTLD doesn't index by device+inode, etc.?

> For example, if an executable is linked with -lfoo and later it
> dlopen()s an object that too is linked with -lfoo, and both, the
> executable and the shared object both record the same SONAME for that
> dependency, then only one copy of libfoo will be brought in.  Same if
> you have two shared objects linked with -lfoo.
> After all dependencies are recorded as SONAMEs, not paths to objects.
> The closest to a path you'll come is via a search path.  Thus when
> loading an object the RTLD will see if its dependencies are already
> loaded.  Even with RTLD_GROUP/LOCAL the RTLD will load only a single
> instance of any object.  RTLD_GROUP/LOCAL affect symbol visibility
> scope, not instance count (one object loaded twice as a local group will
> have a single set of global variables).
> I believe much the same applies to the Linux RTLD (except that it lacks
> (There is a way to load multiple instances of the same SONAME, but that
> involves using dlmopen(3C), and I don't think anyone really tries it.
> It means having multiple C runtimes in the same process, and that
> requires a lot of care.)
> However, just to be safe I've asked the Solaris linker team, and when I
> get an answer I send an update.

I think this is starting to get sufficiently far into the fringe of
viable portability that I would be more comfortable with a "different
SONAMEs" solution.

More information about the krbdev mailing list