Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 207292 - dev-db/mysql-5.0.44-r2 - factorial segfault
Summary: dev-db/mysql-5.0.44-r2 - factorial segfault
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Low trivial (vote)
Assignee: Gentoo Linux MySQL bugs team
URL: http://lists.mysql.com/commits/18906
Whiteboard: 20080124: pending patch
Keywords:
: 186108 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-01-24 15:09 UTC by Evgeniy Kliymovich
Modified: 2008-11-14 06:04 UTC (History)
3 users (show)

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


Attachments
factorial.patch (factorial.patch,473 bytes, patch)
2008-01-24 15:10 UTC, Evgeniy Kliymovich
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Evgeniy Kliymovich 2008-01-24 15:09:17 UTC
Critical error in mysql-5.0.44-r2.
dmesg: 
Jan 23 14:51:23 blik kernel: factorial[25005]: segfault at 0000000000021a11 rip 00000b28d6c5a167 rsp 000072de436ad270 error 4
Comment 1 Evgeniy Kliymovich 2008-01-24 15:10:45 UTC
Created attachment 141724 [details, diff]
factorial.patch

factorial.c patch

Additional information: http://bugs.mysql.com/bug.php?id=14420
Comment 2 Evgeniy Kliymovich 2008-01-24 15:16:12 UTC
This bug take down my server :(. Please add patch to main CVS.

Portage 2.1.3.19 (hardened/amd64, gcc-3.4.6, glibc-2.6.1-r0, 2.6.22-hardened-r8 x86_64)
=================================================================
System uname: 2.6.22-hardened-r8 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 3600+
Timestamp of tree: Thu, 24 Jan 2008 13:30:01 +0000
app-shells/bash:     3.2_p17-r1
dev-lang/python:     2.4.4-r6
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.10-r5
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.23-r2
ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=athlon64 -pipe -pipe -fexpensive-optimizations -fomit-frame-pointer -mmmx -msse -msse2 -msse3 -m3dnow"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /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 -march=athlon64 -pipe -pipe -fexpensive-optimizations -fomit-frame-pointer -mmmx -msse -msse2 -msse3 -m3dnow"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="en_US.UTF-8"
LC_ALL=""
LINGUAS="ru"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="amd64 bzip2 cli cracklib crypt freetype gcc64 gmp hardened ithreads justify mhash midi nls nptl nptlonly pam pic readline rsbac session sse sse2 threads unicode urandom xml xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter 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="mouse keyboard" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="ru" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i810 mach64 mga neomagic nv r128 radeon rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga via vmware voodoo"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-01-25 01:28:12 UTC
In future for MySQL stuff, please link directly to the upstream patch, rather than attaching it here. I will include it soon.
Comment 4 Evgeniy Kliymovich 2008-01-25 03:27:06 UTC
(In reply to comment #3)
> In future for MySQL stuff, please link directly to the upstream patch, rather
> than attaching it here. I will include it soon.
> 

I didn't put direct link because didn't find it. Only several patches on this page http://lists.mysql.com/commits/18906 . But some patches doesn't correctly applied. I have created one patch and have tested it. And I attach it here.

Sorry...
Comment 5 Evgeniy Kliymovich 2008-01-28 01:12:32 UTC
Hi all.

Problem is actual for mysql-5.0.54 also :(
Comment 6 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-01-28 01:27:39 UTC
This is not critical at all.
factorial is only run during the configure process, to find some limits on the machine. I'll patch it later.
Comment 7 Martin Mokrejš 2008-03-01 15:13:49 UTC
Did you apply the patch already? No. ;-) Anyway, the patch does not fix this for me on amd64.

# ulimit -c unlimited
# cd /var/tmp/portage/dev-db/mysql-5.0.54/work/mysql/dbug
# make clean
# make CFLAGS="-ggdb"
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../include -I../include -I../include    -ggdb -MT dbug.o -MD -MP -MF .deps/dbug.Tpo -c -o dbug.o dbug.c
mv -f .deps/dbug.Tpo .deps/dbug.Po
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../include -I../include -I../include    -ggdb -MT sanity.o -MD -MP -MF .deps/sanity.Tpo -c -o sanity.o sanity.c
mv -f .deps/sanity.Tpo .deps/sanity.Po
rm -f libdbug.a
x86_64-pc-linux-gnu-ar cru libdbug.a dbug.o sanity.o 
x86_64-pc-linux-gnu-ranlib libdbug.a
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../include -I../include -I../include    -ggdb -MT my_main.o -MD -MP -MF .deps/my_main.Tpo -c -o my_main.o my_main.c
mv -f .deps/my_main.Tpo .deps/my_main.Po
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../include -I../include -I../include    -ggdb -MT factorial.o -MD -MP -MF .deps/factorial.Tpo -c -o factorial.o factorial.c
mv -f .deps/factorial.Tpo .deps/factorial.Po
/bin/sh ../libtool --preserve-dup-deps --tag=CC   --mode=link x86_64-pc-linux-gnu-gcc  -ggdb  -rdynamic  -o factorial my_main.o factorial.o libdbug.a ../mysys/libmysys.a ../strings/libmystrings.a -lpthread -lcrypt -lnsl -lm  -lpthread 
mkdir .libs
x86_64-pc-linux-gnu-gcc -ggdb -rdynamic -o factorial my_main.o factorial.o  libdbug.a ../mysys/libmysys.a ../strings/libmystrings.a -lpthread -lcrypt -lnsl -lm -lpthread  
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../include -I../include -I../include    -ggdb -MT dbug_analyze.o -MD -MP -MF .deps/dbug_analyze.Tpo -c -o dbug_analyze.o dbug_analyze.c
mv -f .deps/dbug_analyze.Tpo .deps/dbug_analyze.Po
/bin/sh ../libtool --preserve-dup-deps --tag=CC   --mode=link x86_64-pc-linux-gnu-gcc  -ggdb  -rdynamic  -o dbug_analyze dbug_analyze.o libdbug.a ../mysys/libmysys.a ../strings/libmystrings.a -lpthread -lcrypt -lnsl -lm  -lpthread 
x86_64-pc-linux-gnu-gcc -ggdb -rdynamic -o dbug_analyze dbug_analyze.o  libdbug.a ../mysys/libmysys.a ../strings/libmystrings.a -lpthread -lcrypt -lnsl -lm -lpthread  
/bin/rm -f example1.r
/bin/sed -e 's!\\!\\\\!g' example1.c > example1.r
/bin/rm -f example2.r
/bin/sed -e 's!\\!\\\\!g' example2.c > example2.r
/bin/rm -f example3.r
/bin/sed -e 's!\\!\\\\!g' example3.c > example3.r
/bin/rm -f main.r
/bin/sed -e 's!\\!\\\\!g' main.c > main.r
/bin/rm -f factorial.r
/bin/sed -e 's!\\!\\\\!g' factorial.c > factorial.r
./factorial 1 2 3 4 5 | cat > output1.r
./factorial -\#t:o 2 3 | cat >output2.r
./factorial -\#d:t:o 3 | cat >output3.r
./factorial -\#d,result:o 4 | cat >output4.r
./factorial -\#d:f,factorial:F:L:o 3 | cat >output5.r
nroff -mm user.r > user.t
user.r:204: warning: can't find font `C'
user.r:773: warning [p 15, 5.8i]: can't break line
user.r:785: warning [p 15, 8.0i]: can't break line
user.r:795: warning [p 15, 9.8i]: can't break line
user.r:812: warning [p 16, 3.7i]: can't break line
user.r:814: warning [p 16, 3.8i]: cannot adjust line
user.r:1038: warning: indent cannot be negative
groff -mm user.r > user.ps
#gdb ./factorial ./core
GNU gdb 6.7.1
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".

warning: Can't read pathname for load map: Input/output error.
Reading symbols from /lib64/libpthread.so.0...done.
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /lib64/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib64/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib64/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib64/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /lib64/libgcc_s.so.1...done.
Loaded symbols for /lib/libgcc_s.so.1
Core was generated by `./factorial -#d:f,factorial:F:L:o 3'.
Program terminated with signal 11, Segmentation fault.
#0  0x0000000000402b9b in _db_enter_ (_func_=0x4043e6 "main", _file_=0x4043dc "my_main.c", _line_=26, _sfunc_=0x7fff07277228, _sfile_=0x7fff07277220, _slevel_=0x7fff0727721c, _sframep_=0x7fff07277210) at dbug.c:709
709         *_sfunc_ = state->func;
(gdb) where
#0  0x0000000000402b9b in _db_enter_ (_func_=0x4043e6 "main", _file_=0x4043dc "my_main.c", _line_=26, _sfunc_=0x7fff07277228, _sfile_=0x7fff07277220, _slevel_=0x7fff0727721c, _sframep_=0x7fff07277210) at dbug.c:709
#1  0x0000000000402495 in main (argc=3, argv=0x7fff07277318) at my_main.c:26
(gdb) bt full
#0  0x0000000000402b9b in _db_enter_ (_func_=0x4043e6 "main", _file_=0x4043dc "my_main.c", _line_=26, _sfunc_=0x7fff07277228, _sfile_=0x7fff07277220, _slevel_=0x7fff0727721c, _sframep_=0x7fff07277210) at dbug.c:709
        save_errno = 0
        state = (CODE_STATE *) 0x20821
#1  0x0000000000402495 in main (argc=3, argv=0x7fff07277318) at my_main.c:26
        _db_func_ = 0x0
        _db_file_ = 0x7fff07277310 "\003"
        _db_level_ = 0
        _db_framep_ = (char **) 0x404300
        result = 6322160
        ix = 0
(gdb) 
Comment 8 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-11-14 05:23:30 UTC
*** Bug 186108 has been marked as a duplicate of this bug. ***
Comment 9 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-11-14 06:04:50 UTC
iron.udjin/Evgeniy Kliymovich: as noted by  Martin Mokrejs, the patch doesn't solve it.

However, I suspect that 5.0.70 may have fixed the problem anyway.