Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 11 Apr 2022 08:24:21 -0400
From: Jeffrey Walton <>
Cc: Colin Cross <>
Subject: Re: [PATCH] dl_iterate_phdr: return empty string for the name
 of the main program

On Mon, Apr 4, 2022 at 11:57 PM Michael Forney <> wrote:
> On 2022-04-04, Colin Cross <> wrote:
> > The glibc man page for dl_iterate_phdr states:
> > The first object visited by callback is the main program.   For  the  main
> > program,  the
> > dlpi_name field will be an empty string.
> >
> > This is relied upon by the LLVM ASAN runtime:
> >
> >
> > Without this patch, running a binary that has been instrumented with
> > ASAN fails with:
> > ==4156919==ASan runtime does not come first in initial library list; you
> > should either link runtime to your application or manually preload it with
> >
> > Use a constant empty string instead of the DSO name field for the first
> > entry in the DSO list.
> I believe glibc is the exception here, not musl. When I looked at
> this, every other operating system I tried used the program name for
> the first object.

I may be splitting hairs, but the dl_iterate_phdr(3) man page does not
say a program is returned during the enumeration. It says shared
objects are returned.

$ man 3 dl_iterate_phdr

DL_ITERATE_PHDR(3)             Linux Programmer's Manual

      dl_iterate_phdr - walk through list of shared objects

      #define _GNU_SOURCE         /* See feature_test_macros(7) */
      #include <link.h>

      int dl_iterate_phdr(
                int (*callback) (struct dl_phdr_info *info,
                                 size_t size, void *data),
                void *data);

      The  dl_iterate_phdr()  function allows an application to
inquire at run time to
      find out which shared objects it has loaded, and the order in
which  they  were

      The dl_iterate_phdr() function walks through the list of an
application's shared
      objects and calls the function callback once for each object,
until  either  all
      shared objects have been processed or callback returns a nonzero value.



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.