Segfault in _Unwind_* code called from pthread_exit

Tijl Coosemans tijl at FreeBSD.org
Tue Oct 31 09:45:01 UTC 2017


On Mon, 30 Oct 2017 22:54:05 +0100 Andreas Tobler <andreast-list at fgznet.ch> wrote:
> On 30.10.17 15:32, Tijl Coosemans wrote:
>> On Sun, 29 Oct 2017 20:40:46 +0100 Andreas Tobler <andreast-list at fgznet.ch> 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.

The patch looks good to me.  KERN_PROC_SIGTRAMP was added in 9.3 it
seems.  If gcc wants to support older versions you may have to use an
#ifdef like Konstantin did in his first reply in this thread.


More information about the freebsd-current mailing list