From owner-freebsd-current@freebsd.org Fri Aug 25 20:56:10 2017 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23489DE13DB for ; Fri, 25 Aug 2017 20:56:10 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-210-57.reflexion.net [208.70.210.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA44A704F4 for ; Fri, 25 Aug 2017 20:56:09 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 25212 invoked from network); 25 Aug 2017 20:56:07 -0000 Received: from unknown (HELO mail-cs-01.app.dca.reflexion.local) (10.81.19.1) by 0 (rfx-qmail) with SMTP; 25 Aug 2017 20:56:07 -0000 Received: by mail-cs-01.app.dca.reflexion.local (Reflexion email security v8.40.2) with SMTP; Fri, 25 Aug 2017 16:56:07 -0400 (EDT) Received: (qmail 5789 invoked from network); 25 Aug 2017 20:56:07 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 25 Aug 2017 20:56:07 -0000 Received: from [192.168.1.109] (c-67-170-167-181.hsd1.or.comcast.net [67.170.167.181]) by iron2.pdx.net (Postfix) with ESMTPSA id 145E5EC8FC8; Fri, 25 Aug 2017 13:56:07 -0700 (PDT) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: Segfault in _Unwind_* code called from pthread_exit Message-Id: <5E8C029E-F3C2-4442-9334-D9DAE116828B@dsl-only.net> Date: Fri, 25 Aug 2017 13:56:06 -0700 To: Tijl Coosemans , FreeBSD Current X-Mailer: Apple Mail (2.3273) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 20:56:10 -0000 Tijl Coosemans tijl at FreeBSD.org wrote on Fri Aug 25 15:40:10 UTC 2017 : > So both GCC and LLVM unwinding look up the return address in the CFI > table and fail when the return address is garbage, but LLVM treats this > as an end-of-stack condition while GCC further tries to see if the > return address points to a signal trampoline by testing the instruction > bytes at that address. On amd64 the garbage address is unreadable so it > segfaults. On i386 it is readable, the test fails and GCC returns > end-of-stack. > > To fix the crash and get predictable behaviour in the other cases I > propose always setting the return address to 0. The attached patch does > this for i386 and amd64. I don't know if other architectures need a > similar patch. If this is fixed it is possibly the fix for bugzilla report: Bug 221423 - gcc std::locale(LocaleName) crashes instead of throwing an exception It may also fix some examples mentioned in comments for: Bug 221288 - lang/gcc5 links against libsupc++ when compiling but the original description did not happen to involve exception handling from what I can see. Instead __dynamic_cast failed. === Mark Millard markmi at dsl-only.net