From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12853 Path: news.gmane.org!.POSTED!not-for-mail From: Jameson Nash Newsgroups: gmane.linux.lib.musl.general Subject: Re: dl_iterate_phdr() behaves differently on musl and glibc Date: Mon, 28 May 2018 19:16:16 -0400 Message-ID: References: <20180528200243.GH1392@brightrain.aerifal.cx> <20180528221650.GJ1392@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000009eabee056d4c4e80" X-Trace: blaine.gmane.org 1527549531 25684 195.159.176.226 (28 May 2018 23:18:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 28 May 2018 23:18:51 +0000 (UTC) Cc: musl@lists.openwall.com, ararslan@comcast.net, jakub@jirutka.cz To: "Bob B." Original-X-From: musl-return-12869-gllmg-musl=m.gmane.org@lists.openwall.com Tue May 29 01:18:47 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1fNRPa-0006bB-Na for gllmg-musl@m.gmane.org; Tue, 29 May 2018 01:18:46 +0200 Original-Received: (qmail 28129 invoked by uid 550); 28 May 2018 23:20:55 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 23797 invoked from network); 28 May 2018 23:16:39 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Mg8g8KdflUSE3ftO844vakQP/QLS91OrdBPLWVyHqMQ=; b=dGyAFRpuh+TbUkaf2rmlxyCMn4ryMyDmQ6cnWndn9tKErXBwPiwR9G4VpRJ8dMWJvb fCV63S0meIH2yizR6L8jFuzokJuIQvLoOWAY7Cvwf6ELRzq/D0mKfR0RqUTKc0znZBVr 8GtvwiCS7T5IjeSBEUdk+ExQ5OIfUZUuboL6J/iHvVo+3ixyMhjPymnkXSITvntfUaxp bfX1tk9ci0teF0VZWb6U+cy6onLS6ixUJwkQMN+buEFf0lv+z3wHSfPcCJ2yFNXfUzGH SP6F6JM8ENIiMVLGp9MFEB/ow6bThJEVO3K2wFCThzkwV4u31xfZXJSOWk0uMUQLjUfR hZEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Mg8g8KdflUSE3ftO844vakQP/QLS91OrdBPLWVyHqMQ=; b=Y1Z35dOVukpTwhFlcNZkMhBluwWajVPNR8keD3G1CEfgKl6d6G5UghBax5CjPgPvdP BmQqtX6Rpa52rpyctPuhvO04hIAL4Nu8f1vDKRV519rj4VSibeuCPUol4WczSAjxPeB9 Hdpf5tk2Cydmu/tGFpSftiZW0nxQnhLlWCgA9vrAR1yFh6am6Uh/QfAGUzggg3xsAQvg VkX24s7JmuvwO5CXebmmcuAR3IPIY9s+xT3HwFOlt04lWPvQs74pjGqyPF2vwtP/b4th Z504D4GCPMQB2NQcWNqkgBVsV7agFKbMrTHkhqOF6vzzedKw+32Vo6oGCBdcfTzxW3Ud tg3w== X-Gm-Message-State: ALKqPwfb97o/aQfi9tmI9Gk2Um0weiY0DMk360uMdE7oROso3xE88FDJ e9sbijzPiAJMbNksqQgKwd4QYP/bMZBDXcf4VSU= X-Google-Smtp-Source: ADUXVKLyMDIbcPRrFQLeAnn0lMj9N38iD1kyYJdjJeDUMaUhb5RhulLCavhFwALELNtfNnn9uu2CW/Xs8xPzP+45o50= X-Received: by 2002:aca:1218:: with SMTP id 24-v6mr5654388ois.144.1527549387514; Mon, 28 May 2018 16:16:27 -0700 (PDT) In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:12853 Archived-At: --0000000000009eabee056d4c4e80 Content-Type: text/plain; charset="UTF-8" Cool, my motivation for creating `libwhich` in part was to be able to inspect how different systems handle dynamic libraries and this reflection method. So seems like the main difference is just that on Ubuntu the first entry doesn't have a name, and those are explicitly skipped in my code ( https://github.com/vtjnash/libwhich/blob/a11efad57d90fdb95790312d90c8f66d803125cf/libwhich.c#L200 ) Indeed, the example in the Ubuntu manpage also clarifies that: "The first shared object for which output is displayed (where the name is an empty string) is the main program" Which seems to suggest that users should just unconditionally skip the first entry if they aren't interested in the program name. Does that sound right? -Jameson On Mon, May 28, 2018 at 6:32 PM Bob B. wrote: > > Rather than special-casing knowledge of particular systems I think the > > code should just be fixed so that it doesn't break if the main program > > is included. > > I'm CC'ing the libwhich people so let them know and discuss. > For context - http://www.openwall.com/lists/musl/2018/05/28/1 > --0000000000009eabee056d4c4e80 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Cool, my motivation for creating `libwhich` in part was to= be able to inspect how different systems handle dynamic libraries and this= reflection method.

So seems like the main difference is= just that on Ubuntu the first entry doesn't have a name, and those are= explicitly skipped in my code (https://= github.com/vtjnash/libwhich/blob/a11efad57d90fdb95790312d90c8f66d803125cf/l= ibwhich.c#L200)

Indeed, the example in the Ubuntu ma= npage also clarifies that: "The first shared object for which output i= s displayed (where the name is an empty string) is the main program"

Which seems to suggest that users should just uncon= ditionally skip the first entry if they aren't interested in the progra= m name. Does that sound right?

-Jameson
=

On Mon, May = 28, 2018 at 6:32 PM Bob B. <bob66@gmx.c= om> wrote:
> Rather than = special-casing knowledge of particular systems I think the
> code should just be fixed so that it doesn't break if the main pro= gram
> is included.

I'm CC'ing the libwhich people so let them know and discuss.
For context - http://www.openwall.com/lists/musl/2018= /05/28/1
--0000000000009eabee056d4c4e80--