Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 278798 - www-client/mozilla-firefox-3.5.1 segfaults if dev-db/sqlite is compiled with -ftree-vectorize
Summary: www-client/mozilla-firefox-3.5.1 segfaults if dev-db/sqlite is compiled with ...
Status: RESOLVED DUPLICATE of bug 270120
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: High normal with 1 vote (vote)
Assignee: Arfrever Frehtes Taifersar Arahesis (RETIRED)
Depends on:
Reported: 2009-07-23 05:56 UTC by David Korth
Modified: 2009-09-12 16:04 UTC (History)
9 users (show)

See Also:
Package list:
Runtime testing required: ---

GDB output for Firefox with broken sqlite (gdb-sqlite-ftree-vectorize.txt,39.31 KB, text/plain)
2009-07-23 06:00 UTC, David Korth

Note You need to log in before you can comment on or make changes to this bug.
Description David Korth 2009-07-23 05:56:42 UTC
I've traced down an issue with Firefox 3.5.1 if sqlite is compiled with -ftree-vectorize. When compiled with -ftree-vectorize, sqlite uses aligned SSE instructions, but for whatever reason Firefox 3.5.1 doesn't keep the stack aligned. Firefox 3.0.11 did keep the stack aligned.

Reproducible: Always

Steps to Reproduce:
1. emerge sqlite with -ftree-vectorize.
2. emerge mozilla-firefox
3. Run Firefox.

Actual Results:  
Firefox crashes on startup.

Expected Results:  
Firefox should load normally.
Comment 1 David Korth 2009-07-23 05:58:36 UTC
emerge --info:

Portage 2.2_rc33 (default/linux/x86/2008.0, gcc-4.4.0, glibc-2.10.1-r0, 2.6.30-gentoo-r1-gs_laptop i686)
System uname: Linux-2.6.30-gentoo-r1-gs_laptop-i686-Genuine_Intel-R-_CPU_T2500_@_2.00GHz-with-redhat    
Timestamp of tree: Thu, 23 Jul 2009 01:30:01 +0000                                                      
ccache version 2.4 [enabled]                                                                            
app-shells/bash:     3.2_p39                                                                            
dev-java/java-config: 2.1.8-r1                                                                          
dev-lang/python:     2.5.4-r3                                                                           
dev-util/ccache:     2.4-r8                                                                             
dev-util/cmake:      2.6.4-r1                                                                           
sys-apps/baselayout: 2.0.1                                                                              
sys-apps/openrc:     0.4.3-r3                                                                           
sys-apps/sandbox:    1.6-r2                                                                             
sys-devel/autoconf:  2.13, 2.63                                                                         
sys-devel/automake:  1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2                                   
sys-devel/binutils:  2.18-r3                                                                            
sys-devel/gcc-config: 1.4.1                                                                             
sys-devel/libtool:   1.5.26                                                                             
virtual/os-headers:  2.6.27-r2                                                                          
CFLAGS="-O2 -pipe -ggdb -march=native -msse3 -mfpmath=sse -ftree-vectorize -floop-interchange -floop-strip-mine -floop-block"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config /var/lib/hsqldb"     
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d"                                                                                                  
CXXFLAGS="-O2 -pipe -ggdb -march=native -msse3 -mfpmath=sse -ftree-vectorize -floop-interchange -floop-strip-mine -floop-block"                                                                      
FEATURES="ccache distlocks fixpackages preserve-libs protect-owned sandbox sfperms splitdebug strict unmerge-orphans userfetch userpriv usersandbox"                                                 
LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--hash-style=both -Wl,--as-needed"
LINGUAS="en en_US"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTDIR_OVERLAY="/usr/local/portage /usr/local/portage/layman/x11 /usr/local/portage/layman/kde-testing"
USE="X a52 aac aalib accessibility acl acpi addressbook aften aiglx akode akonadi alsa amr amrnb amrwb anthy ao archive asf asm asyncns audiofile avahi berkdb bidi bluetooth bonjour bonobo boost branding bzip2 cairo caps captury cdaudio cdda cddb cdio cdparanoia cdr cisco cjk clamav cli cmake cracklib crypt cups curl cvs cxx daap dbus desktopglobe dga dhcpcd dirac dlloader dmi doc dri dts dv dvb dvd dvdr dvdread enca encode exif exiv2 expat fam fbcon fbcondecor fbsplash ffmpeg fftw flac fontconfig foomaticdb fortran ftp fuse gd gdbm gecko geoip gif gimp ginac git glib glitz glut gmp gnutls google-gadgets gphoto2 gpm graphite graphviz gs gsl gstreamer gtk gtk2 hal handbook hdaps hddtemp hdri hfs howl htmlhandbook ibmacpi iconv icu id3tag idn imagemagick imlib immqt-bc inotify irda isdnlog ithreads jadetex java5 java6 javascript jbig joystick jpeg jpeg2k kde kdehiddenvisibility kipi ktts kvm lame laptop latex lcms libcaca libclamav libffi libgcrypt libnotify libsamplerate libwww live lm_sensors logitech-mouse lzo lzw mad marble matroska mbrola mdnsresponder-compat messenger mhash midi mikmod mime mjpeg mmap mmx mmxext mng modplug moonlight mozdevelop mozsvg mp3 mp4 mpeg mpi mplayer msn mtp mudflap musicbrainz ncurses nepomuk netplay network network-cron nls nodrm npp nptl nptlonly nsplugin ntfs numeric objc objc++ offensive ofx ogg old-daemons openal openexr opengl openmp oscar pam pango pcmcia pcre pdf perl phonon pic plasma plotutils png pnp portaudio ppds pppd python qemu qmake qt-webkit qt3support qt4 quicktime rar rdesktop readline reflection reiserfs resolvconf rss rtc rtsp samba sasl scanner schroedinger sdk sdl semantic-desktop session simplexml slp smime smp sndfile solver sound soup sox speex spell spl sql sqlite sqlite3 srvdir sse sse2 sse3 ssl startup-notification subtitles subversion svg symlink sysfs tcl tcltk tcpd templates tetex themes theora threads threadsafe thumbnail tidy tiff timidity tk tordns tp_smapi tpsmapi truetype unicode urlpicpreview usb userlocales utempter v4l v4l2 vcd vhosts videos vnc vorbis vpnc webdav webkit wifi win32codecs winpopup wlm wma wmf wxwidgets wxwindows x264 x86 xattr xcb xcomposite xext xft xine xinerama xml xml2 xmlpatterns xorg xosd xpm xscreensaver xsl xulrunner xv xvid yahoo yv12 zeroconf zip zlib zvbi" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_alias authn_anon authn_default authn_file authz_default authz_groupfile authz_host authz_owner authz_user autoindex dav dav_fs dav_lock deflate dir env expires ext_filter filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard evdev joystick synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_US" LIRC_DEVICES="atiusb" USERLAND="GNU" VIDEO_CARDS="vesa radeon"
Comment 2 David Korth 2009-07-23 06:00:47 UTC
Created attachment 198875 [details]
GDB output for Firefox with broken sqlite

The instruction it's faulting on is:
0xb662c559 <sqlite3_randomness+249>:    movdqa %xmm4,-0x148(%ebp)                                                                                                                                   

%ebp is 0xbff9acac, so it's definitely an unaligned stack problem.
Comment 3 Adrian Bassett 2009-07-23 13:15:15 UTC
(In reply to comment #2)

This is useful diagnosis - I was seeing firefox-3.5.1 segfaulting (on ~x86 but not, interestingly, on ~amd64) for the same reason, at least as evidenced from strace output.  

I'm only commenting here because, as is often recommended, I had compiled sqlite with -O3.  This optimization level turns -ftree-vectorize on implicitly.  Recompiling sqlite with -O2 omits -ftree-vectorize so that firefox-3.5.1 no longer crashes.

Comment 4 Justin Lecher (RETIRED) gentoo-dev 2009-08-06 06:35:45 UTC
For me too,

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x402f16e0 (LWP 8610)]
0x4244b21b in sqlite3_randomness () from /usr/lib/
(gdb) bt
#0  0x4244b21b in sqlite3_randomness () from /usr/lib/
#1  0x4244bd84 in ?? () from /usr/lib/
#2  0x42454eb4 in ?? () from /usr/lib/
#3  0x42455605 in ?? () from /usr/lib/
#4  0x42455e6b in ?? () from /usr/lib/
#5  0x4245bc9d in ?? () from /usr/lib/
#6  0x4245c0bb in ?? () from /usr/lib/
#7  0x424d4897 in ?? () from /usr/lib/
#8  0x424b9332 in sqlite3_step () from /usr/lib/
#9  0x424b9d0d in sqlite3_exec () from /usr/lib/
#10 0x4194c015 in ?? () from /usr/lib/xulrunner-
#11 0x4197a178 in ?? () from /usr/lib/xulrunner-
#12 0x41979730 in ?? () from /usr/lib/xulrunner-
#13 0x41975d0f in ?? () from /usr/lib/xulrunner-
#14 0x41973f45 in ?? () from /usr/lib/xulrunner-
#15 0x419d8b6e in ?? () from /usr/lib/xulrunner-
#16 0x41b42580 in ?? () from /usr/lib/xulrunner-
#17 0x41b97377 in ?? () from /usr/lib/xulrunner-
#18 0x41b985e9 in ?? () from /usr/lib/xulrunner-
#19 0x41b37974 in ?? () from /usr/lib/xulrunner-
#20 0x41b37e66 in ?? () from /usr/lib/xulrunner-
#21 0x417dbece in ?? () from /usr/lib/xulrunner-
#22 0x417db4d6 in ?? () from /usr/lib/xulrunner-
#23 0x4196aa80 in ?? () from /usr/lib/xulrunner-
#24 0x419d5cab in ?? () from /usr/lib/xulrunner-
#25 0x419bfa15 in ?? () from /usr/lib/xulrunner-
#26 0x419d8dbc in ?? () from /usr/lib/xulrunner-
#27 0x41b42580 in ?? () from /usr/lib/xulrunner-
#28 0x41b971be in ?? () from /usr/lib/xulrunner-
#29 0x41b97912 in ?? () from /usr/lib/xulrunner-
#30 0x40b47902 in ?? () from /usr/lib/xulrunner-
#31 0x41bbb939 in NS_InvokeByIndex_P () from /usr/lib/xulrunner-
#32 0x40b66792 in ?? () from /usr/lib/xulrunner-
#33 0x40b7257d in ?? () from /usr/lib/xulrunner-
#34 0x407a156b in js_Invoke () from /usr/lib/xulrunner-
#35 0x4078c077 in ?? () from /usr/lib/xulrunner-
#36 0x407a15b4 in js_Invoke () from /usr/lib/xulrunner-
#37 0x40b5ded8 in ?? () from /usr/lib/xulrunner-
#38 0x40b5511b in ?? () from /usr/lib/xulrunner-
#39 0x41bbbbb2 in ?? () from /usr/lib/xulrunner-
#40 0x41b97377 in ?? () from /usr/lib/xulrunner-
#41 0x41b985e9 in ?? () from /usr/lib/xulrunner-
#42 0x41b37974 in ?? () from /usr/lib/xulrunner-
#43 0x41b37eac in ?? () from /usr/lib/xulrunner-
#44 0x41b36e73 in ?? () from /usr/lib/xulrunner-
#45 0x41810619 in ?? () from /usr/lib/xulrunner-
#46 0x41b91e1b in ?? () from /usr/lib/xulrunner-
#47 0x40b092f6 in ?? () from /usr/lib/xulrunner-
#48 0x40affb57 in XRE_main () from /usr/lib/xulrunner-
#49 0x080497ec in ?? ()
#50 0x40176a9e in __libc_start_main () from /lib/

Comment 5 Justin Lecher (RETIRED) gentoo-dev 2009-08-06 06:37:19 UTC
Interestingly this only happens on x86 not on amd64.
Comment 6 Peter Sääf 2009-08-14 16:04:09 UTC
To further pin it down I can mention that I started seeing this after upgrading to gcc-4.4.1
firefox/sqlite worked fine when compiled with gcc-4.3.x and -free-vectorize.

I see the reporter is using gcc-4.4.0
Comment 7 Nirbheek Chauhan (RETIRED) gentoo-dev 2009-08-17 12:30:32 UTC
*** Bug 281695 has been marked as a duplicate of this bug. ***
Comment 8 Erik 2009-08-22 20:30:21 UTC
I also had this problem with Mozilla Firefox 3.5.2 (segmentation fault at normal start). I added -fno-tree-vectorize to CFLAGS in /etc/make.conf and executed "emerge sqlite". Now firefox works again. (Using GCC 4.4.1.)
Comment 9 Boney McCracker 2009-08-23 08:31:41 UTC
I am having segfault at start (~x86; gcc-4.4.1), and USE="-fno-tree-vectorize" has no effect.
Comment 10 Erik 2009-08-23 09:40:25 UTC
(In reply to comment #9)
> USE="-fno-tree-vectorize" has no effect.

Of course not. It is not a use flag. It is a compiler flag, so put it in CFLAGS, like I wrote.
Comment 11 Boney McCracker 2009-08-23 09:59:45 UTC
I meant CFLAGS.  I put it in CFLAGS (with my other CFLAGS -- I do know where they go), and it had no effect.
Comment 12 Peter Sääf 2009-08-23 21:13:09 UTC
I don't see why you should hit this bug unless you explicitly added -free-vectorize in the first place.
Comment 13 Boney McCracker 2009-08-23 21:57:25 UTC
I guess my problem is not this bug then.  But it's not the other one either.  I've done everything obvious and am still having sqlite-related problems.  I'm unmerging it and using something else.
Comment 14 Robert Coffree 2009-08-25 13:51:04 UTC
(In reply to comment #13)
> I guess my problem is not this bug then.  But it's not the other one either. 
> I've done everything obvious and am still having sqlite-related problems.  I'm
> unmerging it and using something else.

Happened to me when I compiled xulrunner with gcc 4.4.1
Comment 15 SpanKY gentoo-dev 2009-09-06 16:33:48 UTC
using -ftree-vectorize on x86 system is a really bad idea.  dont do it.

*** This bug has been marked as a duplicate of bug 270120 ***