Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 265986 - app-crypt/mhash-0.9.9.9 fails tests with CFLAGS=-O3 / -ftree-vectorize
Summary: app-crypt/mhash-0.9.9.9 fails tests with CFLAGS=-O3 / -ftree-vectorize
Status: RESOLVED DUPLICATE of bug 270120
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-13 11:52 UTC by Xake
Modified: 2009-11-25 08:39 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xake 2009-04-13 11:52:00 UTC
mhash-0.9.9 fails in the same way, while mhash-0.9.9-r1 works so I believe the alignment-patch is still needed...


Testing save/restore for algorithm RIPEMD320: Ok
Testing save/restore for algorithm SNEFRU128: Ok
Testing save/restore for algorithm SNEFRU256: Ok
Testing save/restore for algorithm MD2: Ok
PASS: rest_test
Checking fragmentation capabilities of MD5: /bin/sh: line 4: 17960 Segmentation fault      (core dumped) ${dir}$tst
FAIL: frag_test
============================================
1 of 5 tests failed
Please report to mhash-devel@sourceforge.net
============================================
make[2]: *** [check-TESTS] Error 1
make[2]: Leaving directory `/var/tmp/portage/app-crypt/mhash-0.9.9.9/work/mhash-0.9.9.9/src'
make[1]: *** [check-am] Error 2
make[1]: Leaving directory `/var/tmp/portage/app-crypt/mhash-0.9.9.9/work/mhash-0.9.9.9/src'
make: *** [check-recursive] Error 1
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-04-13 21:18:43 UTC
please provide:
- emerge --info
- GDB backtrace for the segfault

Upstream merged the alignment patch in a different way in 0.9.9.9.
Comment 2 Xake 2009-04-14 06:12:02 UTC
Ooops, forgot I had -ftree-vectorize in my CFLAGS.
Removing that fixed it, back trace and emerge --info placed for reference.
Do with this bug as you want.

(gdb) bt full
#0  mutils_memset (s=0xbff20eb7, c=0 '\0', n=<value optimized out>) at stdfns.c:182
	stmp = <value optimized out>
	ltmp = (uint32_t *) 0xbff20ec3
	lump = 0
	i = 3
	words = 16
	remainder = 1
#1  0x400009b4 in frag_test (hashid=MHASH_MD5) at frag_test.c:70
	digest1 = '\0' <repeats 24 times>, "\200\002\002@��\001@", '\0' <repeats 28 times>, "\004\023���\022��", '\0' <repeats 32 times>, "H\022��,\000\000\000\0000\002@��\024@T�\034@`\212\017@\001\000\000\000\0000\002@,\000\000\000��\034@�;\035@p\022��]\207\017@��\034@\0000\002@,\000\000\000L\t\002@\0000\002@T�\034@,\000\000\000�;\035@\200\022��\030\212\017@,\000\000\000��\034@�\022���\223\017@��\034@\0000\002@,\000\000\000�\022��T�\034@��\034@�\022��0�\016@��\034@\000\000\000\000��\034@D�"...
	digest2 = "8\000\000\000\b\002", '\0' <repeats 22 times>, "\0343\035@&�\000@\0000\002@��\001\000��\001@$\023��Nl\000@\200\002\002@\020\b\002@\000\000\000\000\000\000\000\000\004d\000@��\001@\004\000\000\000\016\000\000\000� \002@��\001@L\t\002@$\023���c\000@�\v\002@h\021\002@\017\000\000\000libsandbox.so", '\0' <repeats 43 times>, "\020\021��\000\000\000\000@\t\002@�\005\002@", '\0' <repeats 20 times>, "\203�\001@", '\0' <repeats 39 times>
	buf1 = '\0' <repeats 12 times>, "��\a\002@\003\000\000\000�2\035@\000\000\000\000\000\000\000\000\001\000\000\000R�\000@\001\000\000\000@)\002@�\r��|\017���&\002@p\017��\000\000\000\000\230\017���\016��x\027\001@I\000\000\000K\000\000\000�\020��\200\002\002@�6\000@O", '\0' <repeats 11 times>, "R\000\000\000S\000\000\000\000\000\000\000T\000\000\000U\000\000\000\000\000\000\000V", '\0' <repeats 15 times>, "W\000\000\000X\000\000\000Y", '\0' <repeats 11 times>, "Z\000\000\000[\000\000\000]\000\000\000��\001@\221�\000@\000�\001@\000\020\000\000\001\000\000\000��\001@"...
	buf2 = "\000\000\000\0000\216\001@\b\000\000\0000\216\001@P\216\001@ �\001@C�\001@\0000\000@\200\002\002@�\017���5\000@\000\000\000\000\024)\002\000��\001@\t�\017@\001\000\000\000�2\035@�0\001@\b\000\000\000\020\000\000\000\001\000\000\000\000\000\000\000�G\000@\003\000\000\000\000\000\002@�\017��x\027\001@\226�\001@\000\000\000\00027\000@\000\000\000\000\f9\000@\0204\000@\2002\035@��\001@\002\000\000\000�5\000@��\001@\021\000\000\000�3\000@l\020��\233\204\001@\b\000\000\000\210\000\000\00027\000@�3\000@", '\0' <repeats 12 times>, "��\001@\0205"...
	td1 = (MHASH) 0x410fb008
	td2 = (MHASH) 0x410fb090
	input_size = 64
	double_input = 128
	digest_size = 16
	i = 0
	offs = 0
	left = 1073755869
	__PRETTY_FUNCTION__ = "frag_test"
#2  0x40000d9e in main () at frag_test.c:130
	hashid = MHASH_MD5
	s = (const uint8_t *) 0x400859ed "MD5"
	ok = <value optimized out>
	allok = 1
	total = 28


Portage 2.2_rc30 (hardened/x86, gcc-4.3.3, glibc-2.9_p20081201-r4, 2.6.29-gentoo i686)
=================================================================
System uname: Linux-2.6.29-gentoo-i686-Intel-R-_Pentium-R-_4_CPU_2.80GHz-with-gentoo-2.0.0
Timestamp of tree: Tue, 14 Apr 2009 01:00:01 +0000
distcc 3.1 i686-pc-linux-gnu [enabled]
ccache version 2.4 [enabled]
app-shells/bash:     4.0_p17
dev-java/java-config: 2.1.7
dev-lang/python:     2.6.1-r1
dev-python/pycrypto: 2.0.1-r8
dev-util/ccache:     2.4-r8
dev-util/cmake:      2.6.3
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.4.3-r1
sys-apps/sandbox:    1.9
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.5, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.19.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.28-r1
ACCEPT_KEYWORDS="x86 ~x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium4 -pipe -ftracer -ftree-vectorize -ggdb -mtune=pentium4"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
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 -march=pentium4 -pipe -ftracer -ftree-vectorize -ggdb -mtune=pentium4"
DISTDIR="/var/portage/distfiles"
FEATURES="candy ccache distcc distlocks fixpackages metadata-transfer parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict test unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="ftp://ftp.sunet.se/pub/os/Linux/distributions/gentoo"
LANG="sv"
LC_ALL="C"
LDFLAGS="-Wl,--as-needed -Wl,-O1 -Wl,--sort-common -Wl,--warn-once,--hash-style=gnu"
LINGUAS="sv"
MAKEOPTS="-j7 -l5"
PKGDIR="/var/portage/packages"
PORTAGE_CONFIGROOT="/"
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="/var/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/gnome /usr/local/portage/layman/x11 /usr/local/portage/layman/xake-toolchain /usr/local/portage/layman/xake-toolchain2 /usr/local/portage/layman/mozilla /usr/local/portage/layman/java-overlay /usr/local/portage/mine /usr/local/portage/policykit"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa amr amrnb amrwb archive avahi bash-completion bzip2 cairo ccache cdaudio cdda cdr cleartype consolekit cracklib crypt cups cxx dbus deskbar device-mapper dhcpcd digitalradio djvu dvd dvdr dvi eds encode exif faac fat ffmpeg fftw flac fuse gdbm gif glib gmp gnome gnome-keyring gnutls gphoto2 gsf gstreamer gtk hal hardened iconv iconvacl id3tag ieee1394 iptc jabbe java6 jpeg jpeg2k lcms libnotify logrotate lvm mad matroska midi mktemp mms mmx mmxext moonlight mp2 mp3 mpeg mtp mudflap musepack musicbrainz nautilus ncurses network-cron networkmanager nfs nls nptl nptlonly ntfs nvidia offensive ogg opengl openmp openntpd pam pango pcre pdf perl pic pidgin png policykit pulseaudio python qemu quicktime readline samba smp spell sse sse2 ssl startup-notification subversion svg test tex theora threads tiff totem tracker truetype unicode urandom usb userlocales v4l videos vim-syntax vorbis wmf x264 x364 x86 xcb xmp xmpp xorg xulrunner xv xvid xvmc zeroconf zlib" ALSA_CARDS="emu10k1 intel8x0" 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" CAMERAS="canon" ELIBC="glibc" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="sv" USERLAND="GNU" VIDEO_CARDS="nv nouveau"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-04-14 07:00:18 UTC
Try it with:
CFLAGS="-O3 -march=pentium4 -pipe -mtune=pentium4"
and see if you can still get the failure.
Comment 4 Xake 2009-04-14 07:36:36 UTC
Nope, fails too.
Comment 5 Xake 2009-04-28 05:36:28 UTC
Just remembered this bug, reopened so it will not get lost.

I do not know how much of a problem this is and how severe it is?
Is it just broken test-case or is it the application being broken?
And if the latter: how bad is it for my system (i.e. stability, other package breaking and so forth)?
Comment 6 Pinky 2009-07-09 21:02:59 UTC
My backtrace show this:

0x00000030016730f3 in malloc_consolidate () from /lib/libc.so.6
(gdb) backtrace
#0  0x00000030016730f3 in malloc_consolidate () from /lib/libc.so.6
#1  0x0000003001675ac7 in _int_malloc () from /lib/libc.so.6
#2  0x00000030016779ba in malloc () from /lib/libc.so.6
#3  0x0000003000404d5f in mutils_malloc () from /usr/lib/libmhash.so.2
#4  0x0000003000404d9a in mutils_asciify () from /usr/lib/libmhash.so.2
#5  0x0000000000400d80 in main () at keygen_test.c:126
Comment 7 SpanKY gentoo-dev 2009-09-06 16:33:15 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 ***
Comment 8 Ryan Hill (RETIRED) gentoo-dev 2009-10-07 00:04:08 UTC
i'm pretty sure this is a bug in the package, not the compiler.  it fails on amd64 too, and there seems to be a pre-existing history of alignment problems.
Comment 9 Xake 2009-10-07 06:45:57 UTC
Yeh, you are right. Failed on this machine too.
On this machine I did:
CFLAGS="-march=native -pipe -O3" emerge -1 mhash
and it dies in the same way.

Should I reopen this?



$ emerge --info
Portage 2.2_rc44 (hardened/linux/amd64/10.0, gcc-4.4.1, glibc-2.10.1-r0, 2.6.31-hardened x86_64)
=================================================================
System uname: Linux-2.6.31-hardened-x86_64-Intel-R-_Core-TM-_i7_CPU_920_@_2.67GHz-with-gentoo-2.0.1
Timestamp of tree: Wed, 07 Oct 2009 01:00:01 +0000
ccache version 2.4 [disabled]
app-shells/bash:     4.0_p33
dev-java/java-config: 2.1.9-r1
dev-lang/python:     2.6.3, 3.1.1-r1
dev-python/pycrypto: 2.0.1-r8
dev-util/ccache:     2.4-r8
dev-util/cmake:      2.6.4-r3
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.4.3-r3
sys-apps/sandbox:    2.1
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.9.6-r2, 1.10.2, 1.11
sys-devel/binutils:  2.19.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="amd64 ~amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe -ggdb -mtune=native -floop-interchange -floop-strip-mine -floop-block"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
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="-march=native -O2 -pipe -ggdb -mtune=native -floop-interchange -floop-strip-mine -floop-block"
DISTDIR="/var/portage/distfiles"
FEATURES="assume-digests distlocks fixpackages metadata-transfer news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict test unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="ftp://ftp.sunet.se/pub/os/Linux/distributions/gentoo"
LANG="sv_SE.UTF-8"
LC_ALL="C"
LDFLAGS="-Wl,--as-needed -Wl,-O1 -Wl,--sort-common -Wl,--warn-once,--hash-style=gnu"
LINGUAS="sv"
MAKEOPTS="-j25 -l10"
PKGDIR="/var/portage/packages"
PORTAGE_CONFIGROOT="/"
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="/var/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/x11 /usr/local/portage/layman/java-overlay /usr/local/portage/layman/hardened-development /usr/local/portage/layman/gnome /usr/local/portage/layman/anarchy /usr/local/portage/mine"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac accessibility acl acpi alsa amd64 amr amrnb amrwb applet archive avahi bash-completion bluetooth bzip2 cairo ccache cdaudio cdda cdr cleartype cli consolekit cracklib crypt cups cxx dbus deskbar device-mapper devicekit devkit dhcpcd digitalradio djvu dmraid dri dts dvd dvdr dvi eds encode eselect evo exif faac fat fbcondecor ffmpeg fftw flac fuse gdbm gdm gdu gif gimp glib gmp gnome gnome-keyring gnutls gphoto2 gpm grammar graphite gsf gsm gstreamer gtk gudev hal hardened iconv iconvacl icu id3tag idn ieee1394 iptc isdnlog jabber java6 jingle jpeg jpeg2k justify kvm lcms libnotify logrotate lvm lzma mad maps math matroska mktemp mms mmx mmxext moonlight mp2 mp3 mpeg mpi msn mtp mudflap multilib musepack musicbrainz nautilus ncurses network-cron networkmanager nfs nls nptl nptlonly ntfs offensive ogg opencore-amr opengl openmp openntpd ots pam pango parted pcre pdf perl pic pidgin png policykit pppd pulseaudio python qemu quicktime readline reflection samba session smp sms speex spell spl sse sse2 ssl ssse3 startup-notification subversion svg sysfs test tex theora thesaurus threads tiff totem tracker truetype udev unicode upnp urandom usb userlocales v4l vhook videos vim-syntax vorbis x264 xcb xcomposite xmp xmpp xorg xulrunner xv xvid xvmc zeroconf zlib" 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 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" CAMERAS="canon" ELIBC="glibc" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="sv" QEMU_SOFTMMU_TARGETS="i386 x86_64" SANE_BACKENDS="net" USERLAND="GNU" VIDEO_CARDS="nouveau" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 10 Xake 2009-11-25 08:39:03 UTC
Looking into this it is really not the same thing that breaks at 64-bit as in 32-bit.

For 32-bit it is that mhash uses for all arches but sparc a custom malloc, while 64-bit breaks somewhere else (seems to have with mutils_free to do).

A fix for the malloc-thing in this bug would be to patch the source to have mutils_malloc always use system malloc (as it does for sparc). Or just keep away from broken flag.

The 64-bit failure will happen in another bug.