Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 243342 - sys-devel/gcc-4.2: bad mysqld generated and segfaults if compiled with HPPA 2.0 Safe CFLAGS
Summary: sys-devel/gcc-4.2: bad mysqld generated and segfaults if compiled with HPPA 2...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: HPPA Linux
: High normal (vote)
Assignee: HPPA Porters
URL:
Whiteboard:
Keywords:
Depends on: 228287
Blocks: 256430
  Show dependency tree
 
Reported: 2008-10-23 07:24 UTC by René Petzold
Modified: 2009-02-02 15:49 UTC (History)
2 users (show)

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


Attachments
emerge --info (emerge-info.txt,2.64 KB, text/plain)
2008-10-23 07:27 UTC, René Petzold
Details
GDB mysqld backtrace (gdb_mysql_backtrace.txt,1.98 KB, text/plain)
2008-10-24 10:20 UTC, René Petzold
Details

Note You need to log in before you can comment on or make changes to this bug.
Description René Petzold 2008-10-23 07:24:40 UTC
After emerging dev-db/mysql with Gentoo's Safe CFLAGS for HPPA 2.0 enabled in /etc/make.conf the mysqld daemon crashes on startup (signal 11, segmentation fault).

After removing the HPPA 2.0 specific CFLAGS -mschedule=8000 and -march=2.0 and rebuilding dev-db/mysql the mysqld daemon starts without segmentation fault.

I testet this with several mysql-4.1.xx and mysql-5.0.xx ebuilds. The result was always the same.

Reproducible: Always

Steps to Reproduce:
1. Use HPPA 2.0 Safe CFLAGS in /etc/make.conf
2. emerge dev-db/mysql
3. emerge --config dev-db/mysql

Actual Results:  
dev-db/mysql gets compiled with -mschedule=8000 and -march=2.0.
Mysqld daemon crashes with segmentation fault.

Expected Results:  
Modify dev-db/mysql ebuild or mysqld.eclass to filter the HPPA 2.0 CFLAGS -mschedule=8000 and -march=2.0 so that dev-db/mysql gets compiled without these CFLAGS
Comment 1 René Petzold 2008-10-23 07:27:30 UTC
Created attachment 169540 [details]
emerge --info

Here is my emerge --info.
The line in question is 

CFLAGS="-O2 -mschedule=8000 -march=2.0 -fomit-frame-pointer -pipe"

After removing -mschedule=8000 and -march=2.0 and rebuilding dev-db/mysql the mysql daemon starts up fine.
Comment 2 Peter Alfredsen (RETIRED) gentoo-dev 2008-10-23 20:12:32 UTC
Assigning to mysql, but hppa@g.o may have some input to share here?
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-10-23 20:19:08 UTC
hppa team: if you have actual insights as to why this is, go for it, but HPPA hardware is out of testing ability.

René Petzold: I strongly suggest that you start generating debug backtraces etc that actually show where it's segfaulting.
Comment 4 René Petzold 2008-10-24 10:20:19 UTC
Created attachment 169694 [details]
GDB mysqld backtrace

I followed http://www.gentoo.org/doc/en/bugzilla-howto.xml#doc_chap2 to generate a debug backtrace of the segfaulting mysqld. I rebuilt dev-db/mysql with additional -ggdb c(xx)flag before running gdb. 

Hope this helps. Don't know, if this is right. Never really used gdb before.
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-10-24 11:26:07 UTC
I see this: "--datadir=/srv/mysql"
Could you please repeat with a totally stock mysql configuration under Gentoo?
move all your databases and /etc/mysql/my.cnf custom stuff out the way, then do:
emerge mysql && emerge --config mysql && /etc/init.d/mysql start
Comment 6 Guy Martin (RETIRED) gentoo-dev 2008-10-24 11:37:23 UTC
Thanks for your effort to narrow down the problem, however this is probably yet another gcc bug.


I'll dig further into this during the weekend. I'm quite sure it's easily reproducible.
Comment 7 René Petzold 2008-10-24 11:57:22 UTC
(In reply to comment #5)
> I see this: "--datadir=/srv/mysql"
> Could you please repeat with a totally stock mysql configuration under Gentoo?
> move all your databases and /etc/mysql/my.cnf custom stuff out the way, then
> do:
> emerge mysql && emerge --config mysql && /etc/init.d/mysql start
> 

Same result: mysqld is segfaulting. I tried this before.
Running mysqld in gdb with all the additional options was to try to mimic the init script startup.
Comment 8 Guy Martin (RETIRED) gentoo-dev 2008-10-28 12:03:03 UTC
Hey Rene,

I've tried to repro but I wasn't successful.

I've compiled mysql with the same cflags and same gcc but I haven't had the problem.

Looking at the code pointed out by your backtrace, it does seem like a possible gcc bug.

I'm thinking you may be running into #203543.

When did you compiled your GCC ? Can you recompile it again and see if you have a difference ?


Cheers,
  Guy
Comment 9 Jeroen Roovers (RETIRED) gentoo-dev 2008-10-29 06:49:48 UTC
I have tested and run (continuously) every mysql version I ever keyworded, and I haven't seen anything like this.
Comment 10 René Petzold 2008-10-31 08:06:54 UTC
Hi Guy,

br98p153 ~ # genlop sys-devel/gcc
 * sys-devel/gcc
     Mon Sep 22 14:51:43 2008 >>> sys-devel/gcc-4.1.2
     Mon Sep 29 13:21:48 2008 >>> sys-devel/gcc-4.2.4

I compiled sys-devel/gcc 1 month ago. So the path for #203543 should be included. I will recompile it and maybe even try the old sys-devel/gcc-4.1.2 since I ran into problems with sys-devel/gcc-4.3.1.
Comment 11 René Petzold 2008-10-31 12:31:22 UTC
I switched from gcc-4.2.4 back to gcc-4.1.2, recompiled dev-db/mysql-5.0.60-r1 with Safe CFLAGS and now it works. The mysqld daemon starts up fine. No segmentation faults.
Comment 12 Luca Lesinigo 2008-11-14 16:34:07 UTC
I can confirm this and also did some tests:

dev-db/mysql-5.0.60-r1 on HPPA with glibc-2.7-r2
gcc-4.1.2 CFLAGS = CXXFLAGS = "-O2 -march=2.0"              --> works
gcc-4.2.4 CFLAGS = CXXFLAGS = "-O2 -march=2.0"              --> segfaults
gcc-4.2.4 CFLAGS="-O2 -march=2.0" CXXFLAGS="-O2 -march=1.1" --> works
gcc-4.2.4 CFLAGS="-O2 -march=2.0" CXXFLAGS="-O1 -march=2.0" --> works

summary: gcc-4.1.2 isn't affected, gcc-4.2.4 is. CFLAGS doesn't affect the problem. CXXFLAGS need optimization lower than -O2 *OR* -march lower than 2.0 to build a working mysql.

(seems just like bug #228287)
Comment 13 Jeroen Roovers (RETIRED) gentoo-dev 2008-11-14 16:46:36 UTC
(In reply to comment #9)
> I have tested and run (continuously) every mysql version I ever keyworded, and
> I haven't seen anything like this.

The difference being that I haven't seriously put gcc-4.2.4 to the test. I am rather doubting 4.2.4 will ever go stable for HPPA. Maybe it's better to focus on getting 4.3.2 working.
Comment 14 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-11-14 21:17:16 UTC
Ok, so it's a GCC issue, not a mysql one.
Removing mysql-bugs from the tracking
Comment 15 Luca Lesinigo 2008-11-14 23:55:49 UTC
Also confirmed the same issue with dev-db/mysql-5.0.70 on HPPA
Comment 16 Luca Lesinigo 2008-11-15 10:23:11 UTC
(In reply to comment #13)
> Maybe it's better to focus on getting 4.3.2 working.

dev-db/mysql-5.0.60-r1 on HPPA with glibc-2.7-r2
gcc-4.3.2 CFLAGS = CXXFLAGS = "-O2 -march=2.0"              --> works
gcc-4.3.2 CFLAGS="-O2 -march=2.0" CXXFLAGS="-O2 -march=1.1" --> works
gcc-4.3.2 CFLAGS="-O2 -march=2.0" CXXFLAGS="-O1 -march=2.0" --> works

seems like we have the very same issue in gcc-4.2 and 4.3
Comment 17 Luca Lesinigo 2008-11-15 10:24:11 UTC
sorry for the typo. with CFLAGS = CXXFLAGS = "-O2 -march=2.0" it segfaults.
Comment 18 Guy Martin (RETIRED) gentoo-dev 2009-01-10 09:52:28 UTC
This is most probably the same issue than #228287. Patch is on it's way to the tree.
Comment 19 René Petzold 2009-01-19 10:31:35 UTC
So now we need to wait until gcc-4.3.2-r3 appears in the portage tree.
Comment 20 Guy Martin (RETIRED) gentoo-dev 2009-01-19 10:37:47 UTC
This has been added to 4.2.4-r1. We're currently in the process of testing it and we'll mark it stable ASAP.

4.3 isn't ready yet to be stable.

Please let us know if you encounter problems with 4.2.4-r1.

  
Comment 21 Luca Lesinigo 2009-01-22 13:47:35 UTC
Used the same flags that failed above, but upgraded mysql to 5.0.70-r1 and gcc to 4.2.4-r1. It's happily crunching queries right now. Thanks :)

CFLAGS=CXXFLAGS="-pipe -O2 -march=2.0"
dev-db/mysql-5.0.70-r1  USE="perl ssl -berkdb -big-tables -cluster -debug -embedded -extraengine -latin1 -max-idx-128 -minimal (-selinux) -static"
Comment 22 Guy Martin (RETIRED) gentoo-dev 2009-01-22 15:52:45 UTC
Mysql tests working as well for me.

emerge --info attached otherwise JeR will complain again :)


Portage 2.1.6.4 (default/linux/hppa/2008.0, gcc-4.2.4, glibc-2.7-r2, 2.6.28 parisc)
=================================================================
System uname: Linux-2.6.28-parisc-PA8600_-PCX-W+-with-glibc2.2
Timestamp of tree: Unknown
app-shells/bash:     3.2_p39
dev-lang/python:     2.4.4-r13, 2.5.2-r7
dev-python/pycrypto: 2.0.1-r6
dev-util/cmake:      2.4.6-r1
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.63
sys-devel/automake:  1.5, 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.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="hppa"
CBUILD="hppa2.0-unknown-linux-gnu"
CFLAGS="-O2 -pipe -march=2.0"
CHOST="hppa2.0-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -pipe -march=2.0"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://ftp.snt.utwente.nl/pub/os/linux/gentoo"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
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"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X apache2 berkdb bzip2 cli cracklib crypt cups firefox foomaticdb gdbm gpm gtk hppa iconv imlib ipv6 isdnlog jpeg libwww midi mudflap ncurses nls nptl nptlonly openmp pam pcre pcsc-lite perl pic postgres pppd python readline reflection server session smartcard spell spl ssl sysfs tcpd unicode usb xml2 xmlrpc xorg xulrunner zlib" 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 authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="fbdev"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 23 Jeroen Roovers (RETIRED) gentoo-dev 2009-01-23 02:33:01 UTC
With sys-devel/gcc-4.2.4-r1 it's OK...
Comment 24 René Petzold 2009-01-26 07:59:14 UTC
Same here. mysql-5.0.72-r1 runs fine compiled with gcc-4.2.4-r1 and 
CFLAGS=CXXFLAGS="-O2 -mschedule=8000 -march=2.0 -fomit-frame-pointer -pipe"
Comment 25 René Petzold 2009-02-02 15:49:30 UTC
Works with sys-devel/gcc-4.2.4-r1