Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 17 Aug 2012 01:39:34 -0400
From: Rich Felker <>
Subject: Re: ldso : dladdr support

On Thu, Aug 16, 2012 at 12:41:48AM +0200, boris brezillon wrote:
> > Sorry for taking a while to get back to you. I haven't had as much
> > time to work on musl the past couple weeks and some other topics (like
> > mips dynamic linking) had priority, but I hope to have more again for
> > a while now. Here's a quick review of some things that will hopefully
> > turn into a discussion for improving/simplifying the code.
> No problem.
> Thanks for the review.
> Do you want to discuss it on irc or keep going on the mailing list?

List is best I think, but I don't mind having some specific
discussions that need more real-time feedback on IRC.

> > BTW, while I _want_ it to be safe, it's possible that early switches
> > (early meaning prior to the comment in __dynlink that says libc is now
> > fully functional) will actually fail to work/crash on some archs... So
> > this needs consideration too.
> >
> I didn't knew that. Could explain me why?

The compiler may compile a switch to something like:

jmp *local_jmptable@...OFF(%ebx,%ecx,4)

where the local_jmptable needs to contain absolute jump addresses.
Prior to relocation, it will obly have the load-address-relative

> > I'm not seeing why this function needs hash tables at all. It's not
> > looking up symbols, just iterating over the entire symbol table, no?
> > Please explain if I'm mistaken.
> I don't see any other way to know the sym table size except reading
> the .dynsym section header.

Indeed, I missed the fact that there's no DT_* entry reporting the
symbol table size. I checked how readelf reports the number of
entries, and it's using the section headers. I'm under the impression
that using them would not be valid for the dynamic linker; reportedly
ELF files are supposed to be valid even with the section headers

> That's why I'm iterating over the hash table.
> For sysv hash the nchain (second entry of hash table) gives the sym table size.
> For gnu hash It's a little bit more complicated (see

Wow, leave it to the GNU folks to take something simple and make it

> Should we parse the .dynsym section header and store the sym table
> size in dso struct?
> Do you see any other way to get the dynsym table size or at least
> iterate over the dynsym table (specific pattern for last element ?).

I've been looking but I don't see any way yet.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.