Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 278798

Summary: www-client/mozilla-firefox-3.5.1 segfaults if dev-db/sqlite is compiled with -ftree-vectorize
Product: Gentoo Linux Reporter: David Korth <gerbilsoft>
Component: [OLD] LibraryAssignee: Arfrever Frehtes Taifersar Arahesis (RETIRED) <arfrever>
Status: RESOLVED DUPLICATE    
Severity: normal CC: Adrian.Bassett, betelgeuse, esigra, jlec, Martin.vGagern, mozilla, non7top, peter.saaf, rcoffree
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: GDB output for Firefox with broken sqlite

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                                                                          
ACCEPT_KEYWORDS="x86"                                                                                   
CBUILD="i686-pc-linux-gnu"                                                                              
CFLAGS="-O2 -pipe -ggdb -march=native -msse3 -mfpmath=sse -ftree-vectorize -floop-interchange -floop-strip-mine -floop-block"
CHOST="i686-pc-linux-gnu"                                                                                                    
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"                                                                      
DISTDIR="/usr/portage/distfiles"                                                                                                                                                                     
FEATURES="ccache distlocks fixpackages preserve-libs protect-owned sandbox sfperms splitdebug strict unmerge-orphans userfetch userpriv usersandbox"                                                 
GENTOO_MIRRORS="http://gentoo.mirrors.tds.net/gentoo"                                                                                                                                                
LANG="en_US.UTF-8"                                                                                                                                                                                   
LC_ALL="en_US.UTF-8"                                                                                                                                                                                 
LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--hash-style=both -Wl,--as-needed"
LINGUAS="en en_US"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--progress"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /usr/local/portage/layman/x11 /usr/local/portage/layman/kde-testing"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
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"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS
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/libsqlite3.so.0
(gdb) bt
#0  0x4244b21b in sqlite3_randomness () from /usr/lib/libsqlite3.so.0
#1  0x4244bd84 in ?? () from /usr/lib/libsqlite3.so.0
#2  0x42454eb4 in ?? () from /usr/lib/libsqlite3.so.0
#3  0x42455605 in ?? () from /usr/lib/libsqlite3.so.0
#4  0x42455e6b in ?? () from /usr/lib/libsqlite3.so.0
#5  0x4245bc9d in ?? () from /usr/lib/libsqlite3.so.0
#6  0x4245c0bb in ?? () from /usr/lib/libsqlite3.so.0
#7  0x424d4897 in ?? () from /usr/lib/libsqlite3.so.0
#8  0x424b9332 in sqlite3_step () from /usr/lib/libsqlite3.so.0
#9  0x424b9d0d in sqlite3_exec () from /usr/lib/libsqlite3.so.0
#10 0x4194c015 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#11 0x4197a178 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#12 0x41979730 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#13 0x41975d0f in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#14 0x41973f45 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#15 0x419d8b6e in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#16 0x41b42580 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#17 0x41b97377 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#18 0x41b985e9 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#19 0x41b37974 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#20 0x41b37e66 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#21 0x417dbece in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#22 0x417db4d6 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#23 0x4196aa80 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#24 0x419d5cab in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#25 0x419bfa15 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#26 0x419d8dbc in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#27 0x41b42580 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#28 0x41b971be in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#29 0x41b97912 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#30 0x40b47902 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#31 0x41bbb939 in NS_InvokeByIndex_P () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#32 0x40b66792 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#33 0x40b7257d in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#34 0x407a156b in js_Invoke () from /usr/lib/xulrunner-1.9.1.2/libmozjs.so
#35 0x4078c077 in ?? () from /usr/lib/xulrunner-1.9.1.2/libmozjs.so
#36 0x407a15b4 in js_Invoke () from /usr/lib/xulrunner-1.9.1.2/libmozjs.so
#37 0x40b5ded8 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#38 0x40b5511b in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#39 0x41bbbbb2 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#40 0x41b97377 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#41 0x41b985e9 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#42 0x41b37974 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#43 0x41b37eac in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#44 0x41b36e73 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#45 0x41810619 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#46 0x41b91e1b in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#47 0x40b092f6 in ?? () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#48 0x40affb57 in XRE_main () from /usr/lib/xulrunner-1.9.1.2/libxul.so
#49 0x080497ec in ?? ()
#50 0x40176a9e in __libc_start_main () from /lib/libc.so.6


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 ***