From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12846 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: dl_iterate_phdr() behaves differently on musl and glibc Date: Mon, 28 May 2018 16:02:43 -0400 Message-ID: <20180528200243.GH1392@brightrain.aerifal.cx> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1527537653 30260 195.159.176.226 (28 May 2018 20:00:53 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 28 May 2018 20:00:53 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-12862-gllmg-musl=m.gmane.org@lists.openwall.com Mon May 28 22:00:49 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 1fNOK0-0007kq-4W for gllmg-musl@m.gmane.org; Mon, 28 May 2018 22:00:48 +0200 Original-Received: (qmail 21804 invoked by uid 550); 28 May 2018 20:02:56 -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 21786 invoked from network); 28 May 2018 20:02:55 -0000 Content-Disposition: inline In-Reply-To: Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:12846 Archived-At: On Mon, May 28, 2018 at 03:44:15PM +0200, Bob B. wrote: > Hi list. > > I noticed a difference in behavior of dl_iterate_phdr() when playing with musl and glibc. > The program I tried was the example on the bottom of the page: https://linux.die.net/man/3/dl_iterate_phdr > > What happens is that musl returns the program itself when run + shared objects. > glibc only returns the shared objects. > > Not sure which one is right. Or if both are acceptable. > Any light to clear why the different behavior is appreciated. I was unaware of that difference, but omitting the main program seems like a serious limitation that makes the interface a lot less useful. I'm not sure if there's any other way to get the information. The manual page documents the function as enumerating the "shared objects", which one could interpret only as libraries, but I usually consider a dynamic program as a "shared object" itself. Is there a reason musl's behavior is problematic here? Even without the ambiguity I'd be hesitant to change it since programs may be relying on it. Rich