Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 310791 - net-p2p/amule-2.2.6 segfaults with dev-libs/crypto++-2.6.0-r1 and USE=-sse3
Summary: net-p2p/amule-2.2.6 segfaults with dev-libs/crypto++-2.6.0-r1 and USE=-sse3
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo net-p2p team
URL:
Whiteboard:
Keywords:
: 314695 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-03-22 19:57 UTC by Nick Bowler
Modified: 2010-10-09 14:04 UTC (History)
10 users (show)

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


Attachments
Patch for dev-libs/crypto++ to compile without sse3 (sse3.patch,485 bytes, patch)
2010-03-24 12:41 UTC, kirin yuri
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Bowler 2010-03-22 19:57:42 UTC
If crypto++-2.6.0-r1 is compiled with USE=-sse3, then amule (also amuled) segfaults immediately upon startup.  Attempting to get a backtrace suggests that this might not be the whole issue, as amule /also/ seems to work perfectly fine if compiled with USE=debug.  Here's the backtrace (without debug symbols in amule) anyway.

Starting program: /usr/bin/amule 
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff54f9141 in memcpy () from /lib/libc.so.6
(gdb) bt
#0  0x00007ffff54f9141 in memcpy () from /lib/libc.so.6
#1  0x00007ffff731a139 in CryptoPP::SHA256::InitState (state=0x441d10)
    at sha.cpp:96
#2  0x00007ffff71e69c2 in IteratedHashWithStaticTransform (this=0x7fffffffd670)
    at iterhash.h:88
#3  0x00007ffff71e6a2b in SHA256 (this=0x7fffffffd670) at sha.h:21
#4  0x00007ffff72e8fcb in CryptoPP::RandomPool::IncorporateEntropy (
    this=0xb2a680, 
    input=0xb49140 "؁\326_\236/\206G\"\025\354iIP V\237\274\247\v\016\204 '\333-\022H9\364ȝ", length=32) at randpool.cpp:26
#5  0x00007ffff72d97a6 in CryptoPP::AutoSeededRandomPool::Reseed (
    this=0xb2a680, blocking=false, seedSize=32) at osrng.cpp:164
#6  0x00000000005cc75f in ?? ()
#7  0x0000000000649302 in ?? ()
#8  0x00007ffff7ffb000 in ?? ()
#9  0x0000000000649250 in ?? ()
#10 0x0000000000000000 in ?? ()

To make things more interesting, on a machine which does not support SSE3, I need to turn on the sse3 USE flag to get a working amule.

Portage 2.1.7.17 (default/linux/amd64/10.0, gcc-4.3.4, glibc-2.10.1-r1, 2.6.34-rc2 x86_64)
=================================================================
System uname: Linux-2.6.34-rc2-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q8300_@_2.50GHz-with-gentoo-2.0.1
Timestamp of tree: Mon, 22 Mar 2010 14:30:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     4.0_p35
dev-lang/python:     2.6.4-r1
dev-python/pycrypto: 2.1.0_beta1
dev-util/ccache:     2.4-r7
dev-util/cmake:      2.6.4-r3
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.0-r1
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.65
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.18-r3
sys-devel/gcc:       4.3.4
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=core2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/bin/startx /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=core2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going --with-bdeps=y"
FEATURES="assume-digests ccache distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://mirror.datapipe.net/gentoo"
LANG="en_CA.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en_CA en ja"
MAKEOPTS="-j5"
PKGDIR="/usr/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="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl alsa amd64 berkdb bzip2 cairo cjk cli cracklib crypt cups curl cvs cxx doc dri exif fbcon ffmpeg flac fortran gdbm gpm graphviz gtk iconv idn imagemagick ipv6 jadetex jpeg kpathsea latex lcms mmx modules mudflap multilib ncurses nis nls nptl nptlonly ogg opengl openmp pam pcre perl png postgres pppd python readline reflection sdl session smp spl sse sse2 ssl svg sysfs tcpd tex4ht theora tiff truetype unicode vim-syntax vorbis xcb xinerama xorg xulrunner xv 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 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" LINGUAS="en_CA en ja" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="intel" 
Unset:  CPPFLAGS, CTARGET, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Paul Osmialowski 2010-03-22 22:20:45 UTC
I have the same here, net-p2p/amule-2.2.6, dev-libs/crypto++-5.6.0-r1 and P4 SMP CPU with flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe pebs bts cid xtpr
error message: amule[15156]: segfault at b75c4ff4 ip b74c0dbf sp bfee4e68 error 7 in libcrypto++.so.0.0.0[b71a5000+3e8000]

Setting USE flag sse3 solves problem with amule on this non-SSE3 CPU. Strange.
Comment 2 kirin yuri 2010-03-24 11:03:37 UTC
I got the same thing. Just mask amule-2.2.6 and crypto++-5.6.0-r1.
Comment 3 kirin yuri 2010-03-24 12:41:46 UTC
Created attachment 225099 [details, diff]
Patch for dev-libs/crypto++ to compile without sse3

This is patch for dev-libs/crypto++ to compile on computers without sse3.
Amule works fine with new library.
Comment 4 Angelo D'Autilia (sYdRo) 2010-03-27 13:33:37 UTC
(In reply to comment #3)
> Created an attachment (id=225099) [details]
> Patch for dev-libs/crypto++ to compile without sse3
> 
> This is patch for dev-libs/crypto++ to compile on computers without sse3.
> Amule works fine with new library.
> 

With patch it is ok ;)
Comment 5 Bruno Barão 2010-03-27 18:02:31 UTC
With the patch, it works for me too. Earlier versions also have this problem.
Comment 6 Raúl Porcel (RETIRED) gentoo-dev 2010-03-27 19:21:51 UTC
That patch what does is pass -DCRYPTOPP_DISABLE_SSE3 instead of -DCRYPTOPP_DISABLE_SSE2. However -DCRYPTOPP_DISABLE_SSE3 does nothing while DISABLE_SSE2 does...

So its not a proper fix...
Comment 7 kirin yuri 2010-03-28 10:18:26 UTC
You are right. There is no -DCRYPTOPP_DISABLE_SSE3 in the cryptopp source code.
Is it correct to just remove -DCRYPTOPP_DISABLE_SSE2 option for systems without sse3?
Comment 8 Jyrki Launonen 2010-03-28 19:46:50 UTC
(In reply to comment #1)
> Setting USE flag sse3 solves problem with amule on this non-SSE3 CPU. Strange.

Indeed, amule segfaulted if crypto++ was built with -sse3 and enabling it (on this also non-SSE3 CPU) corrected the problem.
Do I interpret that "use sse3" line in crypto++-5.6.0-r1.ebuild correctly, if I understand it meaning "if sse3 is NOT used, then disable sse2" (note numbers)?
I'd say, thoose two things are not really related in that way and should be changed to "if sse2 is not used, then disable sse2"  (which in ebuild format is
  use sse2 || append-flags -DCRYPTOPP_DISABLE_SSE2
plus IUSE="sse2" )).
That would raise a new problem, though: My CPU has sse2-support, so enabling (this new) sse2 would leave sse2 on in crypto++ and thus, would result in crashing amule. ...returning to initial square.
Comment 9 Jyrki Launonen 2010-03-29 05:01:36 UTC
(In reply to comment #8)
> That would raise a new problem, though: My CPU has sse2-support, so enabling
> (this new) sse2 would leave sse2 on in crypto++ and thus, would result in
> crashing amule. ...returning to initial square.
I meant of course, that +sse2 would work, but -sse2 would not which is weird. I might later take a look of some things including the meaning of *_DISABLE_SSE2.
Comment 10 Tommaso Pasini 2010-04-07 08:27:45 UTC
I have a pentium3 machine, which means that it doesn't support neither sse3 nor sse2; the segfault happened. Downgrading to crypto++-5.5.2-r1 (rebuilding amule afterwards) fixed it.

I still have a problem where amuled freezes on first start and I have to kill it and restart it, but I still have to figure out why, and that should go on a separate bug.
Comment 11 Raúl Porcel (RETIRED) gentoo-dev 2010-04-11 16:56:04 UTC
*** Bug 314695 has been marked as a duplicate of this bug. ***
Comment 12 E. Scaglione 2010-04-14 18:08:15 UTC
The sse2 use flag was turned into sse3 because of this bug http://bugs.gentoo.org/show_bug.cgi?id=314695, the reporter was using system without sse3, probably it was bug now the only file that uses that instruction (panama.cpp) correctly uses #if CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE to compile only if available. On my system without sse2 or sse3 compiles fine, probably the flag should be renamed back as sse2 and a new flag sse3 added.
Comment 13 E. Scaglione 2010-04-14 18:14:36 UTC
Sorry I wrote it in a hurry, I retry in english:

The sse2 use flag was turned into sse3 because of this bug
http://bugs.gentoo.org/show_bug.cgi?id=314695, the reporter was using a system
without sse3, probably it was a bug in crypto++ that was later fixed: the only file that uses palignr (panama.cpp) correctly uses #if CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE to use sse3 instructions
only if available. 
On my system without sse3 support and with with USE=sse3 compiles fine, probably
the flag should be renamed back as sse2 and a new flag sse3 added that removes -DCRYPTOPP_DISABLE_SSSE3
Comment 14 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-04-25 00:55:21 UTC
"sse3" USE flag in dev-libs/crypto++-5.6.0-r1 has been deleted.
Comment 15 tekwyzrd 2010-06-03 04:14:32 UTC
This may be fixed for some but amule still will mot run for me on my athlon xp. The GUI doesn't appear and no error messages. Prior to the migration to crypto++-5.6.0-r1 I ran v2.2.6 and the svn snapshots with no problems.

Currently amule pulls crypto++-5.6.0-r1 as a dependency making it impossible to test functionality with previous versions of crypto++ so I'm trying amule v2.2.5 with crypto++-5.5.2