Description of problem: User space application (modified openposix testsuite for pthread_detach) is getting sporadically aborted by signal 6, because gcc_assert() at _Unwind_SetSpColumn() fails. When looking at a core file in gdb: (gdb) bt #0 0x0000008066374e50 in raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 #1 0x0000008066376de4 in abort () at abort.c:92 #2 0x000000806687e504 in _Unwind_SetSpColumn (context=0xfff8336df58, outer_cfa=0xfff8336e610, outer_ra=0x8066548904) at ../../../gcc/unwind-dw2.c:1265 #3 uw_init_context_1 (context=0xfff8336df58, outer_cfa=0xfff8336e610, outer_ra=0x8066548904) at ../../../gcc/unwind-dw2.c:1472 #4 0x000000806687ebe0 in _Unwind_ForcedUnwind (exc=0xfff8336f670, stop=@0x8066560ad8: 0x8066545660 <unwind_stop>, stop_argument=0xfff8336e880) at ../../../gcc/unwind.inc:201 #5 0x0000008066548904 in _Unwind_ForcedUnwind (exc=<value optimized out>, stop=<value optimized out>, stop_argument=<value optimized out>) at ../nptl/sysdeps/pthread/unwind-forcedunwind.c:132 #6 0x0000008066545600 in __pthread_unwind (buf=<value optimized out>) at unwind.c:130 #7 0x0000008066545bac in __do_cancel () at pthreadP.h:265 #8 __pthread_enable_asynccancel () at cancellation.c:49 #9 0x000000806653c568 in start_thread (arg=0xfff8336f200) at pthread_create.c:289 #10 0x000000806643a32c in .__clone () from /lib64/libc-2.12.so (gdb) frame 2 #2 0x000000806687e504 in _Unwind_SetSpColumn (context=0xfff8336df58, outer_cfa=0xfff8336e610, outer_ra=0x8066548904) at ../../../gcc/unwind-dw2.c:1265 1265 gcc_assert (size == sizeof(_Unwind_Word)); Version-Release number of selected component (if applicable): RHEL-6.3 Server ppc64 gcc-4.4.6-4.el6.ppc64 glibc-2.12-1.80.el6.ppc64 How reproducible: attached reproducer can usually hit the issue within minutes Steps to Reproduce: 1. run attached reproducer as unprivileged user on power7 host Actual results: application is aborted by signal 6 Expected results: no gcc_assert failure Additional info: I have seen failure only on ppc64 (power7). This comment in upstream bugzilla seems to fit: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52839#c10
Created attachment 607556 [details] reproducer that can trigger the gcc_assert As unprivileged user run on power7 host: ulimit -c unlimited gcc -g3 -O0 gcc_assert_dw2.c -lpthread ./a.out Within few minutes it should hit gcc_aseert at: #2 0x000000806687e504 in _Unwind_SetSpColumn (context=0xfff8070df58, outer_cfa=0xfff8070e610, outer_ra=0x8066548904) at ../../../gcc/unwind-dw2.c:1265 1265 gcc_assert (size == sizeof(_Unwind_Word));
From the PR that sounds like a libpthread bug.
Agreed. Actually Alan M. posted a patch to the libc-alpha list in late July. Unfortunately that patch was reported to hang stuff on ppc32 and when I threw it into brew for fun, it hung builds for both ppc32 and ppc64. Somehow that last hunk munges things -- I'm not sure if it's the missing "memory" clobber in the asm, or using GENERAL_REGS instead of BASE_REGS for the address of once_control. AFAICT, that last hunk is just a slightly optimized read barrier + atomic_increment. So I've kept the atomic_increment and just added a call to atomic_read_barrier (and kept the other changes). Builds/testing in progress.
Created attachment 608381 [details] Potential fix from Alan Modra 16 parallel instances of the test just passed 100k iterations each without tripping a failure which is about 10x longer than they'd ever managed to go before without tripping. I'm going to let it run overnight, but I'm pretty sure we've got the right fix.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2013-0279.html