tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: dl_iterate_phdr(3) include the ELF loader



On 10.09.2019 18:24, Joerg Sonnenberger wrote:
> On Tue, Sep 10, 2019 at 05:42:41PM +0200, Kamil Rytarowski wrote:
>> dl_iterate_phdr(3) as of now skips the ELF loader.
> 
> I find that to be sensible behavior, so why not start by descriping why
> it is a problem?
> 
> Joerg
> 

dl_iterate_pthr(3) is/was Linux-specific function and we break compat
with it (but I skip .Sh HISTORY entry whether Linux was really the first
user).

All tested ELF OSs except NetBSD return the ELF loader as DSO.

This behavior is already present in linkmap:

        _rtld_linkmap_add(_rtld_objmain);
        _rtld_objself.path = xstrdup(_rtld_objself.path);
        _rtld_linkmap_add(&_rtld_objself);

I need the ELF loader mapping returned by this function.

ELF loader is mentioned in many/all similar functions, such as
kinfo_vmmap(3), but without the useful details located in dl_phdr_info.

I find the proposed behavior to be more natural and sensible.

If we want to break the compat for some reason with
Linux/FreeBSD/OpenBSD what is the alternative approach to get filled
dl_phdr_info entry for the ELF loader?

Attachment: signature.asc
Description: OpenPGP digital signature



Home | Main Index | Thread Index | Old Index