From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32534 invoked by alias); 26 Jun 2018 11:21:28 -0000 Mailing-List: contact gnu-gabi-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: gnu-gabi-owner@sourceware.org Received: (qmail 32492 invoked by uid 89); 26 Jun 2018 11:21:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.4 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*i:sk:0b0e49f, H*f:sk:0b0e49f, HContent-Transfer-Encoding:8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-Spam-User: qpsmtpd, 3 recipients X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 Jun 2018 11:21:26 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 316E57A7E8; Tue, 26 Jun 2018 11:21:25 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-116-177.ams2.redhat.com [10.36.116.177]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4E24C2166B5D; Tue, 26 Jun 2018 11:21:21 +0000 (UTC) Subject: Re: Invalid program counters and unwinding To: Nathan Sidwell , GCC , GNU C Library , Binutils , gnu-gabi@sourceware.org References: <7ada5491-f3f4-e048-dfec-6e51cd937163@acm.org> <0c58f1bb-220c-d03d-7375-6066fb7d53e6@redhat.com> <0b0e49f0-7ed0-aa4e-a4df-d4286206dab5@acm.org> From: Florian Weimer Message-ID: <8a147f05-509f-16a0-f108-9e76bcae4ea9@redhat.com> Date: Mon, 01 Jan 2018 00:00:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <0b0e49f0-7ed0-aa4e-a4df-d4286206dab5@acm.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 26 Jun 2018 11:21:25 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 26 Jun 2018 11:21:25 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'fweimer@redhat.com' RCPT:'' X-IsSubscribed: yes X-SW-Source: 2018-q2/txt/msg00018.txt.bz2 On 06/26/2018 01:15 PM, Nathan Sidwell wrote: > On 06/26/2018 07:01 AM, Florian Weimer wrote: >> On 06/26/2018 12:56 PM, Nathan Sidwell wrote: >>> On 06/26/2018 05:26 AM, Florian Weimer wrote: >>> >>>> So it looks to me that the caller of _Unwind_Find_FDE needs to >>>> ensure that the PC is a valid element of the call stack.  Is this a >>>> correct assumption? >>> >>> I thought this was an (implicit?) requirement. You're unwinding a >>> stack to deliver an exception up it.  Are there use cases where that >>> is not the case? >> >> We have something approaching this scenario. >> >> pthread_cancel in glibc unwinds the stack using DWARF information >> until encounters a frame without unwind information, when it switches >> to longjmp to get past that obstacle. > > This is a long jump to the originating pthread function at the end of > the stack, right?  We not only get past the obstacle, but any and all > DWARF frames on top of it.  (just for my understanding) Essentially yes. It can also be an intermediate jump buffer, used to to support compilation in -fno-exceptions mode. In that case, unwinding tries to proceed from there, again with a valid PC. > That sounds right. It's a PC that you could return to if you weren't trying to unwind the stack. GCC doesn't do this AFAIK, but it's theoretically possible not to preserve the return address for a noreturn function. But that would be very bad for exception handling, so let's hope compilers don't do this. Florian