Open Bug 1058309 Opened 12 years ago Updated 4 years ago

Segmentation fault in TimeStamp::Now during static initialization

Categories

(Core :: XPCOM, defect)

PowerPC
Linux
defect

Tracking

()

People

(Reporter: stevensn, Unassigned)

Details

Attachments

(2 files, 1 obsolete file)

This is happening on my Linux ppc32 builds of firefox Firefox segfaults on startup during static initialization of xpcom components. 0x0c353930 in mozilla::TimeStamp::Now (aHighResolution=213) at /media/nfs/usb_drive_src/firefox/mozilla-central-hg/src/xpcom/ds/TimeStamp_posix.cpp:199 Stack trace BEFORE the crash #0 mozilla::TimeStamp::Now (aHighResolution=true) at /media/nfs/usb_drive_src/firefox/mozilla-central-hg/src/xpcom/ds/TimeStamp_posix.cpp:199 #1 0x0c2f84d0 in Now () at ../../dist/include/mozilla/TimeStamp.h:275 #2 TimeStampInitialization (this=0xf501418 <mozilla::sInitOnce>) at /media/nfs/usb_drive_src/firefox/mozilla-central-hg/src/xpcom/ds/TimeStamp.cpp:37 #3 __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at /media/nfs/usb_drive_src/firefox/mozilla-central-hg/src/xpcom/ds/TimeStamp.cpp:46 #4 _GLOBAL__sub_I_Unified_cpp_xpcom_ds0.cpp(void) () at /media/nfs/usb_drive_src/firefox/mozilla-central-hg/src/xpcom/ds/nsVariant.cpp:2264 #5 0xf7faf7fc in call_init.part.0 () from /lib/ld.so.1 This started happening in mozilla-central around the end of July or early August. My ppc64 builds are fine
Breakpoint 1, mozilla::TimeStamp::Now (aHighResolution=true) at /media/nfs/usb_drive_src/firefox/mozilla-central-hg/src/xpcom/ds/TimeStamp_posix.cpp:199 199 { (gdb) disas Dump of assembler code for function mozilla::TimeStamp::Now(bool): => 0x0c34041c <+0>: mflr r0 0x0c340420 <+4>: mr r11,r1 0x0c340424 <+8>: stwu r1,-16(r1) 0x0c340428 <+12>: bl 0xc3406fc 0x0c34042c <+16>: stw r0,20(r1) 0x0c340430 <+20>: mr r31,r3 0x0c340434 <+24>: bl 0xc340070 <ClockTimeNs()> 0x0c340438 <+28>: addi r11,r1,16 0x0c34043c <+32>: stw r3,0(r31) 0x0c340440 <+36>: stw r4,4(r31) 0x0c340444 <+40>: mr r3,r31 0x0c340448 <+44>: b 0xc34071c End of assembler dump. Dump of assembler code from 0xc3406fc to 0xc34070f: 0x0c3406fc: mflr r0 0x0c340700: bcl 20,4*cr7+so,0xc340704 0x0c340704: mflr r12 0x0c340708: addis r12,r12,513 0x0c34070c: addi r12,r12,-31980 I am not a ppc assembler expert but => 0x0c34041c <+0>: mflr r0 followed by 0x0c340428 <+12>: bl 0xc3406fc 0x0c34042c <+16>: stw r0,20(r1) where 0xc3406fc does a 0x0c3406fc: mflr r0 seems wrong to me. We are storing the link-return in $r0 then jumping to 0xc3406fc which again stores the link return in $r0 before $r0 is saved to the stack. When I do an objdump -d on TimeStamp_posix.cpp 0000053c <_ZN7mozilla9TimeStamp3NowEb>: 53c: 7c 08 02 a6 mflr r0 540: 7c 2b 0b 78 mr r11,r1 544: 94 21 ff f0 stwu r1,-16(r1) 548: 48 00 00 01 bl 548 <_ZN7mozilla9TimeStamp3NowEb+0xc> 54c: 90 01 00 14 stw r0,20(r1) 550: 7c 7f 1b 78 mr r31,r3 554: 4b ff fc 3d bl 190 <_ZL11ClockTimeNsv> 558: 39 61 00 10 addi r11,r1,16 55c: 90 7f 00 00 stw r3,0(r31) 560: 90 9f 00 04 stw r4,4(r31) 564: 7f e3 fb 78 mr r3,r31 568: 48 00 00 00 b 568 <_ZN7mozilla9TimeStamp3NowEb+0x2c> If I compile TimeStamp_posix.cpp with -O0 instead of -Os the problem goes away but I then get similar issues in other xpcom code during static initialization such as ZN19nsACString_internal6AssignERKS_
g++ --save-temps -m32 -o TimeStamp_posix.o -c -I../../dist/stl_wrappers -I../../dist/system_wrappers -include /media/nfs/usb_drive_src/firefox/mozilla-central-hg/src/config/gcc_hidden.h -DMOZ_GLUE_IN_PROGRAM -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -DSTATIC_EXPORTABLE_JS_API -DAB_CD=en-US -DNO_NSPR_10_SUPPORT -I/media/nfs/usb_drive_src/firefox/mozilla-central-hg/src/xpcom/ds -I. -I/media/nfs/usb_drive_src/firefox/mozilla-central-hg/src/xpcom/ds/../io -I../../dist/include -I/home/ssinger/build-out.ppc32nonunified/dist/include/nspr -I/home/ssinger/build-out.ppc32nonunified/dist/include/nss -fPIC -DMOZILLA_CLIENT -include ../../mozilla-config.h -MD -MP -MF .deps/TimeStamp_posix.o.pp -Wall -Wpointer-arith -Woverloaded-virtual -Werror=return-type -Werror=int-to-pointer-cast -Werror=type-limits -Wempty-body -Wsign-compare -Wno-invalid-offsetof -Wcast-align -fno-exceptions -fno-strict-aliasing -fno-rtti -fno-exceptions -fno-math-errno -std=gnu++0x -pthread -pipe -DNDEBUG -DTRIMMED -g -freorder-blocks -Os -fomit-frame-pointer -frename-registers /media/nfs/usb_drive_src/firefox/mozilla-central-hg/src/xpcom/ds/TimeStamp_posix.cpp Attached is the output with the --save-temps option to gcc gcc --version gcc (GCC) 4.7.2 20121109 (Red Hat 4.7.2-8) Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Attached file TimeStamp_posix.s —
Attachment #8482367 - Attachment is obsolete: true
Attached file TimeStamp_posix.ii —
Also worth mentioning objdump -d /usr/lib/gcc/ppc64-redhat-linux/4.7.2/32/libgcc.a contains 00000044 <_savegpr_31>: 44: 93 eb ff fc stw r31,-4(r11) 48: 4e 80 00 20 blr
(In reply to Steve Singer (:stevensn) from comment #2) > gcc --version > gcc (GCC) 4.7.2 20121109 (Red Hat 4.7.2-8) > Copyright (C) 2012 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This is a fairly old gcc. Which distro are you using? Is it up-to-date? I tried to reproduce it on Fedora 20 (gcc-c++-4.8.3-1.fc20.ppc) and I get a different output. I recommend you try using a newer version of gcc.
Upgrading to fedora 19 with a newer gcc fixed the problem. Debian 7.5(ppc32) only includes gcc 4.7.2 and 4.6.3 and I can reproduce the same issue on my debian machine. I assume I could build/install a newer gcc on that machine but I doubt that will be acceptable to the downstream debian packagers Mike Hommey , what version of gcc is being used to build the firefox ppc debian packages, do you get the same crash on m-c or m-a? If so is upgrading gcc to 4.8 an option? Can you think of any build option changes that went into m-c around the end of July that might have triggered this?
Flags: needinfo?(mh+mozilla)
debian ppc packages use gcc 4.9, but there aren't aurora/central builds for ppc so i can't tell anything.
Flags: needinfo?(mh+mozilla)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: