From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11791 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: possible bug in setjmp implementation for ppc64 Date: Wed, 2 Aug 2017 19:02:57 -0400 Message-ID: <20170802230257.GL1627@brightrain.aerifal.cx> References: <1501520360.0.593167188853569@go.bunnymail.go> <20170731203007.GB1627@brightrain.aerifal.cx> <20170801051042.GA14914@dora.lan> 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 1501715000 21909 195.159.176.226 (2 Aug 2017 23:03:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 2 Aug 2017 23:03:20 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-11804-gllmg-musl=m.gmane.org@lists.openwall.com Thu Aug 03 01:03:16 2017 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 1dd2fR-0004vC-Oq for gllmg-musl@m.gmane.org; Thu, 03 Aug 2017 01:03:05 +0200 Original-Received: (qmail 7776 invoked by uid 550); 2 Aug 2017 23:03:09 -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 7758 invoked from network); 2 Aug 2017 23:03:09 -0000 Content-Disposition: inline In-Reply-To: Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:11791 Archived-At: On Thu, Aug 03, 2017 at 02:00:03AM +0300, Alexander Monakov wrote: > On Tue, 1 Aug 2017, David Edelsohn wrote: > > "If glibc is built as a static library, the contents of r2 are saved > > in the jmp_buf; but if glibc is built as a dynamic library, the > > contents of the TOC save slot is saved in the jmp_buf. Similarly, if > > glibc is built as a dynamic library, longjmp *updates* the TOC save > > slot with the r2 value from the jmp_buf before returning." > > > > GLIBC setjmp/longjmp code explicitly differs for shared and static > > versions of the library. Musl libc needs equivalent functionality in > > its implementation. > > Note that since Glibc also supports static dlopen, it is possible to arrive > at a situation where libc.a longjmp is used for returning to a call site > of libc.so setjmp, in which case TOC save slot is not restored as it > ought to be, and the caller of setjmp segfaults. A testcase is available at > https://sourceware.org/bugzilla/show_bug.cgi?id=21895 Thanks for investigating and writing this up. Rich