From owner-freebsd-current@freebsd.org Tue Oct 31 19:49:54 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 91123E620AB for ; Tue, 31 Oct 2017 19:49:54 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 386662A99; Tue, 31 Oct 2017 19:49:54 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v9VJnkc1068288 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 31 Oct 2017 21:49:46 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v9VJnkc1068288 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v9VJnjTK068286; Tue, 31 Oct 2017 21:49:45 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 31 Oct 2017 21:49:45 +0200 From: Konstantin Belousov To: Andreas Tobler Cc: Tijl Coosemans , freebsd-current@FreeBSD.org, gerald@FreeBSD.org Subject: Re: Segfault in _Unwind_* code called from pthread_exit Message-ID: <20171031194945.GF2566@kib.kiev.ua> References: <20170825234442.GO1700@kib.kiev.ua> <20170826202813.1240a1ef@kalimero.tijl.coosemans.org> <20170826184034.GR1700@kib.kiev.ua> <20171029182351.502f53cf@kalimero.tijl.coosemans.org> <20171029191358.GU2566@kib.kiev.ua> <9a724da4-70f1-4330-9a77-619739008a14@fgznet.ch> <20171030153207.15a42a1e@kalimero.tijl.coosemans.org> <9468430e-fda4-10f4-b6a0-aa40d7d64f5b@fgznet.ch> <20171031092803.GA2566@kib.kiev.ua> <9619a1f8-bb42-abc9-a4ee-3b93192f365e@fgznet.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9619a1f8-bb42-abc9-a4ee-3b93192f365e@fgznet.ch> User-Agent: Mutt/1.9.1 (2017-09-22) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home 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: Tue, 31 Oct 2017 19:49:54 -0000 On Tue, Oct 31, 2017 at 08:37:29PM +0100, Andreas Tobler wrote: > On 31.10.17 10:28, Konstantin Belousov wrote: > > On Mon, Oct 30, 2017 at 10:54:05PM +0100, Andreas Tobler wrote: > >> On 30.10.17 15:32, Tijl Coosemans wrote: > >>> On Sun, 29 Oct 2017 20:40:46 +0100 Andreas Tobler wrote: > >>>> Attached what I have for libgcc. It can be applied to gcc5-8, should > >>>> give no issues. The mentioned tc from this thread and mine, > >>>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82635 do pass. > >>>> > >>>> What do you think? > >>> > >>> Like I said before the return address can be anything. It could for > >>> instance point to some instruction in a random function and then the > >>> stack unwinder will think thread_start was called from that function. > >>> There's no check you can add to libgcc to distinguish that from a > >>> normal valid return address. > >>> > >> Maybe not, and most probably I do not understand what is happening. But > >> with my modification I survive the test case. > >> > >> If no objections from your or Konstantin's side come up I will commit it > >> to the gcc repo. It will not 'fix' the issue, but it will improve the > >> gcc behavior. > > > > I posted something similar when the discussion thread started. From the > > cursory look, your patch is better than mine. The only difference that > > makes me wonder is that I used #ifdef KERN_PROC_SIGTRAMP around the > > block because I believe gcc has more relaxed policy about supporting > > obsoleted OS versions. > > I am aware about KERN_PROC_SIGTRAMP and older OS releases, that's why I > asked for feedback. > Do we, FreeBSD'ers, want to have gcc unwind support on older than > FreeBSD 9.3 releases? I think the gcc folks do not care, but we are the > ones who might have an need for such a support? Well, I put the #ifdef because I suspected that gcc folks cared, if anybody. For instance I know that perl people do. Is there some specific configuration bits in gcc that are only relevant for older releases ? If yes, then we perhaps should not break them until removed. If not, then it does not matter, most likely. > @Gerald, do you have an opinion? > > I can 'ifdef' the new code and in the 'else' case we fall back to the > already existing path.