[Bug 278551] pthread_join() kills the process with a return code of 134

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 24 Apr 2024 15:52:37 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278551

Konstantin Belousov <kib@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dim@FreeBSD.org

--- Comment #4 from Konstantin Belousov <kib@FreeBSD.org> ---
So this issue only happens for the static binary built with gcc.
The thing that fails is the gcc unwinder:

#0  0x00000000004d4dca in thr_kill ()
#1  0x00000000004c226f in raise ()
#2  0x00000000004df6f9 in abort ()
#3  0x0000000000402bef in uw_init_context_1 (
    context=context@entry=0x7fffdfffdd50, 
    outer_cfa=outer_cfa@entry=0x7fffdfffdf80, 
    outer_ra=0x4b2326 <thread_unwind+54>)
    at ../../../gcc-13.2.0/libgcc/unwind-dw2.c:1336
#4  0x00000000004ad986 in _Unwind_ForcedUnwind (exc=0x800818940, 
    stop=0x4b24d0 <thread_unwind_stop>, stop_argument=0x0)
    at ../../../gcc-13.2.0/libgcc/unwind.inc:212
#5  0x00000000004b2326 in thread_unwind ()
#6  0x00000000004b228c in _pthread_exit_mask ()
#7  0x00000000004b21fb in pthread_exit ()
#8  0x00000000004b1e6d in thread_start ()
#9  0x0000000000000000 in ?? ()

It fails because gcc' _Unwind_IteratePhdrCallback() insists on finding
PT_GNU_EH_FRAME which is missed for gcc-compiled binary:
Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flg    Align
  LOAD           0x0000000000000000 0x0000000000400000 0x0000000000400000
                 0x00000000001523d8 0x00000000001523d8  R E    0x1000
  LOAD           0x0000000000153000 0x0000000000553000 0x0000000000553000
                 0x0000000000050274 0x0000000000273c30  RW     0x1000
  NOTE           0x0000000000000158 0x0000000000400158 0x0000000000400158
                 0x0000000000000048 0x0000000000000048  R      0x4
  TLS            0x00000000001973f0 0x00000000005973f0 0x00000000005973f0
                 0x0000000000001850 0x0000000000002080  R      0x10
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     0x10
The EH_FRAME segment is present for clang++.

I have no idea why.

-- 
You are receiving this mail because:
You are the assignee for the bug.