[uClibc] ldso bug in uclibc?

Andrew de Quincey adq_dvb at lidskialf.net
Mon Nov 8 14:47:34 UTC 2004


> > > I thought about having a global group id - when you load a library for
> > > the first time, it, and any dependencies all get the current value of
> > > the group id. The group id is then incremented for the next dlopen().
> > > The problem with this is libraries can belong to multiple groups...
> > > This could happen if it is a sublibrary used by multiple RTLD_LOCAL
> > > dlopen()ed objects.
> > >
> > > It sounds like each toplevel tpnt (i.e. one opened directly by
> > > dlopen()) needs a list of pointers to the tpnts in its group. Then
> > > during the symbol resolution, you just check each library is GLOBAL, or
> > > in the list before checking its symbols.
> >
> > Crap. that doesn't work either.
> >
> > Actually doesn't this group thing mean there are unsolvable problems:
> >
> > Say libsub.so is as described above - a sublibrary used by two RTLD_LOCAL
> > dlopened() objects - and it requires a symbol. How does it know which
> > group to resolve against?
>
> The first matching group in load order, I think. This is the way it works
> for multiple symbols in the GLOBAL list.

Right. OK, what about combining the two.

Each toplevel .so gets given a unique groupid. This is stored in its tpnt 
structure.

We have meta-tpnt entries in the tpnt list. These don't represent a real 
library - they represent the groups. They have a list of members of the 
group, as well as the group id. The order of this list does not matter.

So resolution works as follows:

1) If the current entry is GLOBAL, check it.

2) If the current entry is a meta-tpnt, and the library requesting the symbol 
has a groupid matching the meta-tpnt, try to resolve against members of the 
group (see below).

3) If the current entry is a meta-tpnt, and the library requesting the symbol 
does not have a groupid, first check if it is in the meta-tpnt. If it is, try 
to resolve against members of the group.

Resolving against members of a group is done by recursively reprocessing the 
master tpnt list, but only checking group members. This means we'll be forced 
to (correctly) do it in load order. As group lists do not contain meta-tpnts, 
the recursion will only ever be one level deep.

Finally, if an entry in the master tpnt list is LOCAL, and we're not 
attempting to resolve a group, we ignore it.



More information about the uClibc mailing list