From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2084 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: PATCH: dl_iterate_phdr() Date: Thu, 11 Oct 2012 20:00:34 -0400 Message-ID: <20121012000034.GC254@brightrain.aerifal.cx> References: <20121011234255.GB254@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1350000556 8082 80.91.229.3 (12 Oct 2012 00:09:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 12 Oct 2012 00:09:16 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2085-gllmg-musl=m.gmane.org@lists.openwall.com Fri Oct 12 02:09:23 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1TMSoc-00016p-TE for gllmg-musl@plane.gmane.org; Fri, 12 Oct 2012 02:09:23 +0200 Original-Received: (qmail 15910 invoked by uid 550); 12 Oct 2012 00:09:16 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 15899 invoked from network); 12 Oct 2012 00:09:16 -0000 Content-Disposition: inline In-Reply-To: <20121011234255.GB254@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2084 Archived-At: On Thu, Oct 11, 2012 at 07:42:55PM -0400, Rich Felker wrote: > Otherwise, looks okay! Actually one more issue -- it needs to be made thread-safe. This would just be a matter of obtaining a read-lock on the dynamic linker lock, except that this lock should not be held during callbacks to application code, which need not return in bounded time. Instead, I think it would work to read the global "tail" while a read-lock is held, then use a loop of the form: for (current=head; ; current=current->next) { ... if (current == saved_tail) break; } This will simply skip any new libraries that were not (fully) loaded yet at the time of the call to dl_iterate_phdr. Rich