Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 271190 - dev-lang/ruby-1.9.1_p129 segfault while compiling under Hardened Gentoo (amd64)
Summary: dev-lang/ruby-1.9.1_p129 segfault while compiling under Hardened Gentoo (amd64)
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Gentoo Ruby Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-25 10:41 UTC by Sztupák Sz. Zsolt
Modified: 2010-07-29 10:08 UTC (History)
2 users (show)

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


Attachments
Build.log of the error (build.log,32.88 KB, text/plain)
2009-05-26 08:22 UTC, Sztupák Sz. Zsolt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sztupák Sz. Zsolt 2009-05-25 10:41:30 UTC
Ruby 1.9 won't compile but drops a segmentation fault, while compiling although compiling ruby by hand from the vanila sources works fine. The error seems to be some of the flags that are added while compiling with emerge. These flags are:

-fforce-addr
-fno-strict-aliasing

From which the latter is added by the ebuild.

Removing -fforce-addr didn't solve the problem, but removing both (-fforce-addr and -fno-strict-aliasing) from the ebuild solved the problem, now ruby 1.9 compiles and runs fine (although the ebuild says that compiling without this flag is risky)

Reproducible: Always

Steps to Reproduce:
1. emerge -pv ruby

Actual Results:  
segmentation fault while running ./miniruby

Expected Results:  
the application should compile

Removing -fno-strict-aliasing solved the problem.

Using hardened gentoo with the latest kernel as of today.

The compilation halted while compiling the base ruby executable, so use flags are not affected
Comment 1 SpanKY gentoo-dev 2009-05-26 07:20:27 UTC
post your `emerge --info` like every bug report is supposed to include.  *removing* -fno-strict-aliasing doesnt sound like sanity as that flag should be safe to add everywhere ...
Comment 2 Sztupák Sz. Zsolt 2009-05-26 08:19:00 UTC
=================================================================
Here is the output of "emerge --info":
=================================================================

Portage 2.1.6.11 (hardened/linux/amd64/2008.0, gcc-3.4.6, glibc-2.6.1-r0, 2.6.28-hardened-r7 x86_64)
=================================================================
System uname: Linux-2.6.28-hardened-r7-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q6600_@_2.40GHz-with-glibc2.3.2
Timestamp of tree: Mon, 25 May 2009 22:00:17 +0000
app-shells/bash:     3.2_p33
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python:     2.5.2-r7
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r2
sys-devel/automake:  1.4_p6, 1.5, 1.7.9-r1, 1.9.6-r2, 1.10.1-r1
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.23-r3
ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -fforce-addr"
CHOST="x86_64-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/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -pipe -fforce-addr"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LC_ALL="hu_HU.UTF-8"
LDFLAGS="-Wl,-O1"
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"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="7zip aac acl amd64 amr apache2 bash-completion bashlogger berkdb bzip2 cli cracklib crypt cups dev-lang/php dri emacs encode examples ftp gdbm gif gpm hardened iconv ipv6 isdnlog java java5 jpeg justify kerberos midi mmx mp2 mudflap multilib musepack ncurses nls nptl nptlonly ogg pam pcre perl pic png pppd python rar readline reflection ruby session spell spl sse sse2 ssl sysfs tcpd theora tiff truetype unicode urandom vim-pager vim-syntax vorbis x264 xattr xml xorg xvid 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" USERLAND="GNU" VIDEO_CARDS="fbdev glint i810 intel mach64 mga neomagic nv r128 radeon savage sis tdfx trident vesa vga via vmware voodoo"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY


=================================================================
I tried re-emerging ruby with the default settings, here is the point where it breaks:
=================================================================

x86_64-pc-linux-gnu-gcc -O2 -pipe -fforce-addr -fno-strict-aliasing -O2 -g -Wall -Wno-parentheses  -fPIC  -I. -I.ext/include/x86_64-linux -I./include -I.  -DRUBY_EXPORT -fno-strict-aliasing   -o utf_8.o -c ./enc/utf_8.c
x86_64-pc-linux-gnu-gcc -O2 -pipe -fforce-addr -fno-strict-aliasing -O2 -g -Wall -Wno-parentheses  -fPIC  -I. -I.ext/include/x86_64-linux -I./include -I.  -DRUBY_EXPORT -fno-strict-aliasing   -o newline.o -c newline.c
x86_64-pc-linux-gnu-gcc -O2 -pipe -fforce-addr -fno-strict-aliasing -O2 -g -Wall -Wno-parentheses  -fPIC  -I. -I.ext/include/x86_64-linux -I./include -I.  -DRUBY_EXPORT -fno-strict-aliasing   -o strlcpy.o -c ./missing/strlcpy.c
x86_64-pc-linux-gnu-gcc -O2 -pipe -fforce-addr -fno-strict-aliasing -O2 -g -Wall -Wno-parentheses  -fPIC  -I. -I.ext/include/x86_64-linux -I./include -I.  -DRUBY_EXPORT -fno-strict-aliasing   -o strlcat.o -c ./missing/strlcat.c
x86_64-pc-linux-gnu-gcc -O2 -pipe -fforce-addr -fno-strict-aliasing -O2 -g -Wall -Wno-parentheses  -fPIC  -I. -I.ext/include/x86_64-linux -I./include -I.  -DRUBY_EXPORT -fno-strict-aliasing   -o dmyext.o -c dmyext.c
x86_64-pc-linux-gnu-gcc -O2 -pipe -fforce-addr -fno-strict-aliasing -O2 -g -Wall -Wno-parentheses  -fPIC  -L. -Wl,-O1 -rdynamic -Wl,-export-dynamic -Wl,-O1  main.o dln.o dmyencoding.o miniprelude.o array.o bignum.o class.o compar.o complex.o dir.o enum.o enumerator.o error.o eval.o load.o proc.o file.o gc.o hash.o inits.o io.o marshal.o math.o numeric.o object.o pack.o parse.o process.o random.o range.o rational.o re.o regcomp.o regenc.o regerror.o regexec.o regparse.o regsyntax.o ruby.o safe.o signal.o sprintf.o st.o strftime.o string.o struct.o time.o transcode.o util.o variable.o version.o compile.o debug.o iseq.o vm.o vm_dump.o thread.o cont.o ascii.o us_ascii.o unicode.o utf_8.o newline.o strlcpy.o strlcat.o  dmyext.o  -lpthread -lrt -ldl -lcrypt -lm   -o miniruby
./miniruby: [BUG] Segmentation fault
ruby 1.9.1p129 (2009-05-12 revision 23412) [x86_64-linux]

-- control frame ----------
c:0003 p:---- s:0006 b:0006 l:000005 d:000005 CFUNC  :require
c:0002 p:2014659544 s:0004 b:0004 l:000003 d:000003 TOP
c:0001 p:0000 s:0002 b:0002 l:0025b8 d:0025b8 TOP
---------------------------
-- Ruby level backtrace information-----------------------------------------
./miniruby:0:in `require'

-- C level backtrace information -------------------------------------------
0x17c3f152783 ./miniruby(rb_vm_bugreport+0x43) [0x17c3f152783]
0x17c3f0609f4 ./miniruby [0x17c3f0609f4]
0x17c3f060b16 ./miniruby(rb_bug+0xb6) [0x17c3f060b16]
0x17c3f0f8e9e ./miniruby [0x17c3f0f8e9e]
0x3354c9268fe0 /lib/libpthread.so.0 [0x3354c9268fe0]
0x17c3f12f3ff ./miniruby [0x17c3f12f3ff]
0x17c3f1307fb ./miniruby [0x17c3f1307fb]
0x17c3f13462f ./miniruby [0x17c3f13462f]
0x17c3f1340bc ./miniruby [0x17c3f1340bc]
0x17c3f133fcb ./miniruby [0x17c3f133fcb]
0x17c3f13993a ./miniruby(rb_iseq_compile_node+0xca) [0x17c3f13993a]
0x17c3f13c4cc ./miniruby [0x17c3f13c4cc]
0x17c3f13c540 ./miniruby(rb_iseq_new_with_opt+0x20) [0x17c3f13c540]
0x17c3f13c645 ./miniruby(rb_iseq_new_top+0x25) [0x17c3f13c645]
0x17c3f068491 ./miniruby(rb_load+0x171) [0x17c3f068491]
0x17c3f068dbe ./miniruby(rb_require_safe+0x68e) [0x17c3f068dbe]
0x17c3f068e7f ./miniruby(rb_f_require+0x2f) [0x17c3f068e7f]
0x17c3f14a405 ./miniruby [0x17c3f14a405]
0x17c3f14b00c ./miniruby(rb_funcall2+0x13c) [0x17c3f14b00c]
0x17c3f0f4bf4 ./miniruby [0x17c3f0f4bf4]
0x17c3f0f6a4c ./miniruby [0x17c3f0f6a4c]
0x17c3f0655fb ./miniruby(rb_ensure+0xeb) [0x17c3f0655fb]
0x17c3f0f6d4b ./miniruby [0x17c3f0f6d4b]
0x17c3f0f7947 ./miniruby [0x17c3f0f7947]
0x17c3f14ed5f ./miniruby(rb_vm_call_cfunc+0xcf) [0x17c3f14ed5f]
0x17c3f0f7d11 ./miniruby(ruby_process_options+0xc1) [0x17c3f0f7d11]
0x17c3f066041 ./miniruby(ruby_options+0xa1) [0x17c3f066041]
0x17c3f0350f7 ./miniruby(main+0x57) [0x17c3f0350f7]
0x3354c9d5db76 /lib/libc.so.6(__libc_start_main+0xf6) [0x3354c9d5db76]
0x17c3f034ff9 ./miniruby [0x17c3f034ff9]

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

make: *** [.rbconfig.time] Félbeszakítva
 *
 * ERROR: dev-lang/ruby-1.9.1_p129 failed.
 * Call stack:
 *               ebuild.sh, line   48:  Called src_compile
 *             environment, line 3316:  Called die
 * The specific snippet of code:
 *       emake EXTLDFLAGS="${LDFLAGS}" || die "emake failed"
 *  The die message:
 *   emake failed
 *
 * If you need support, post the topmost build error, and the call stack if relevant.
 * A complete build log is located at '/var/tmp/portage/dev-lang/ruby-1.9.1_p129/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-lang/ruby-1.9.1_p129/temp/environment'.
 *

>>> Failed to emerge dev-lang/ruby-1.9.1_p129, Log file:

=================================================================
Other:
=================================================================

- Ruby 1.8.6 was already installed on the server (didn't try to re-emerge it)
- Old kernel version used while building some parts of the system was 2.6.25-hardened-r7, which had a known bug.
- Ruby 1.9.1 without "no-strict-alias" runs fine. Runned the tests of various 1.9.1 compatible gems and they runned without error.
Comment 3 Sztupák Sz. Zsolt 2009-05-26 08:22:32 UTC
Created attachment 192476 [details]
Build.log of the error
Comment 4 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-07-29 10:08:11 UTC
Please reopen if it's still a problem with 1.9.2_rc2.