Bug 852445 - gcc_assert failure in _Unwind_SetSpColumn() on ppc64
gcc_assert failure in _Unwind_SetSpColumn() on ppc64
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: glibc (Show other bugs)
6.3
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Patsy Franklin
qe-baseos-tools
:
Depends On:
Blocks: 905941 906079 1103874
  Show dependency treegraph
 
Reported: 2012-08-28 10:02 EDT by Jan Stancek
Modified: 2016-11-24 07:32 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
cause: The PPC specific pthread_once code did not correctly publish changes it made.  As a result, those changes were not visible to other threads at the proper time. fix: release barriers were added to the appropriate PPC pthread code to ensure proper synchronization of data between multiple threads.
Story Points: ---
Clone Of:
: 905941 (view as bug list)
Environment:
Last Closed: 2013-02-21 02:05:50 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
reproducer that can trigger the gcc_assert (2.62 KB, application/octet-stream)
2012-08-28 10:05 EDT, Jan Stancek
no flags Details
Potential fix from Alan Modra (4.29 KB, patch)
2012-08-31 00:47 EDT, Jeff Law
no flags Details | Diff

  None (edit)
Description Jan Stancek 2012-08-28 10:02:16 EDT
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
Comment 1 Jan Stancek 2012-08-28 10:05:20 EDT
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));
Comment 3 Jakub Jelinek 2012-08-28 12:57:38 EDT
From the PR that sounds like a libpthread bug.
Comment 4 Jeff Law 2012-08-30 15:03:02 EDT
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.
Comment 6 Jeff Law 2012-08-31 00:47:33 EDT
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.
Comment 23 errata-xmlrpc 2013-02-21 02:05:50 EST
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

Note You need to log in before you can comment on or make changes to this bug.