Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 376735 - dev-lang/php on hardened - src_configure(): segmentation faults in conftest
Summary: dev-lang/php on hardened - src_configure(): segmentation faults in conftest
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-28 13:31 UTC by Agostino Sarubbo
Modified: 2016-06-09 23:03 UTC (History)
0 users

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


Attachments
grsec.log (grsec.log,2.14 KB, text/plain)
2011-07-28 13:31 UTC, Agostino Sarubbo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2011-07-28 13:31:20 UTC
Created attachment 281265 [details]
grsec.log

Portage 2.1.10.3 (hardened/linux/amd64, gcc-4.4.5, glibc-2.12.2-r0, 2.6.39-hardened-r6-xxxx-std-ipv6-64 x86_64)
=================================================================                                                                                                                   
System uname: Linux-2.6.39-hardened-r6-xxxx-std-ipv6-64-x86_64-Intel-R-_Core-TM-_i7_CPU_950_@_3.07GHz-with-gentoo-2.0.3                                                             
Timestamp of tree: Tue, 26 Jul 2011 09:30:01 +0000                                                                                                                                  
app-shells/bash:          4.1_p9                                                                                                                                                    
dev-java/java-config:     2.1.11-r3                                                                                                                                                 
dev-lang/python:          2.7.1-r1                                                                                                                                                  
dev-util/cmake:           2.8.4-r1                                                                                                                                                  
dev-util/pkgconfig:       0.26                                                                                                                                                      
sys-apps/baselayout:      2.0.3                                                                                                                                                     
sys-apps/openrc:          0.8.3-r1                                                                                                                                                  
sys-apps/sandbox:         2.4                                                                                                                                                       
sys-devel/autoconf:       2.68                                                                                                                                                      
sys-devel/automake:       1.11.1                                                                                                                                                    
sys-devel/binutils:       2.20.1-r1                                                                                                                                                 
sys-devel/gcc:            4.4.5                                                                                                                                                     
sys-devel/gcc-config:     1.4.1-r1                                                                                                                                                  
sys-devel/libtool:        2.2.10                                                                                                                                                    
sys-devel/make:           3.82                                                                                                                                                      
sys-kernel/linux-headers: 2.6.36.1 (virtual/os-headers)                                                                                                                             
sys-libs/glibc:           2.12.2                                                                                                                                                    
Repositories: gentoo ineluctable-overlay x-portage x-layman                                                                                                                         
ACCEPT_KEYWORDS="amd64"                                                                                                                                                             
ACCEPT_LICENSE="*"                                                                                                                                                                  
CBUILD="x86_64-pc-linux-gnu"                                                                                                                                                        
CFLAGS="-march=native -O2 -g0 -w"                                                                                                                                                   
CHOST="x86_64-pc-linux-gnu"                                                                                                                                                         
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa /var/bind /var/lib/redmine/config /var/qmail/alias /var/qmail/control /var/vpopmail/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/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /var/lib/redmine/config/locales /var/lib/redmine/config/settings.yml"
CXXFLAGS="-march=native -O2 -g0 -w"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--nospinner --with-bdeps y --deep 45 --backtrack=45 --complete-graph y"
FEATURES="assume-digests binpkg-logs collision-protect distlocks ebuild-locks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK=" /usr/lib*/*.a /usr/lib/lib[0-9]*.la /usr/lib/lib[a-k]*.la /usr/lib/lib[m-z]*.la /usr/lib/libl[0-9]*.la /usr/lib/libl[a-s]*.la /usr/lib/libl[u-z]*.la /usr/lib/liblt[0-9]*.la /usr/lib/liblt[a-c]*.la /usr/lib/liblt[e-z]*.la /usr/lib/libltd[0-9]*.la /usr/lib/libltd[a-k]*.la /usr/lib/libltd[m-z]*.la /usr/lib/libltdl[0-9]*.la /usr/lib/libltdl[a-z]*.la"
LANG="en_GB.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,now -Wl,--hash-style=gnu"
LINGUAS="en en_GB ru uk it de fr fi"
MAKEOPTS="-j2 -s"
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="/var/lib/layman/ineluctable-overlay /usr/local/portage /var/lib/layman"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="acl acpi amd64 apache2 bzip2 caps chroot cli cracklib crypt dri fam fftw gpm hardened iconv idn imap ipv6 justify maildir mmap mmx modules multilib mysql network-cron nocxx nptl nptlonly openmp pam pcre pppd python2 qmail qmail-spp session spamassassin sse sse2 ssl symlink sysfs threads truetype unicode urandom utf8 uuid vpopmail xattr xml xorg zlib" 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 cgi cgid 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 auth_digest reqtimeout status" CALLIGRA_FEATURES="braindump flow karbon kexi kpresenter krita tables words" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_GB ru uk it de fr fi" NGINX_MODULES_HTTP="auth_basic charset empty_gif fastcgi gzip memcached proxy referer rewrite scgi split_clients ssi upstream_ip_hash userid uwsgi access" NGINX_MODULES_MAIL="imap smtp" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Rafał Mużyło 2011-07-28 15:45:18 UTC
It would help if i.e. there was a note in config.log which test exactly did segfault.
Comment 2 Anthony Basile gentoo-dev 2011-08-12 00:59:00 UTC
@ago, can you give us instructions on how to reproduce, in particular, the use flags.  I've been using php-5.3.6 production since it first went stable no problem, so this failed test is probably minor and we could just patch the build system to skip the test.  Or just flat out ignore it.
Comment 3 Agostino Sarubbo gentoo-dev 2011-08-12 01:04:13 UTC
[ebuild   R    ] dev-lang/php-5.3.6  USE="apache2 bcmath bzip2 cli crypt ctype curl exif fileinfo filter fpm ftp gd gmp hash iconv imap inifile intl ipv6 json ldap mysql mysqli pdo phar pic posix postgres session simplexml soap sockets sqlite3 ssl threads tokenizer truetype unicode xml xmlreader xmlrpc xmlwriter xsl zip zlib (-adabas) -berkdb (-birdstep) -calendar -cdb -cgi -cjk -curlwrappers -db2 (-dbmaker) -debug -doc -embed (-empress) (-empress-bcs) -enchant (-esoob) -firebird -flatfile (-frontbase) -gd-external -gdbm -interbase -iodbc -kerberos -kolab -ldap-sasl -libedit -mhash -mssql -mysqlnd -nls -oci8 -oci8-instant-client -odbc -pcntl -qdbm -readline -recode -sapdb -sharedext -sharedmem -snmp (-solid) -spell -sqlite (-sybase-ct) -sysvipc -tidy -wddx -xpm" 0 kB 


Other info?
Comment 4 Ole Markus With (RETIRED) gentoo-dev 2012-02-14 13:15:45 UTC
Can this be reproduced in later versions of PHP?
Comment 5 Agostino Sarubbo gentoo-dev 2012-02-15 23:17:54 UTC
(In reply to comment #4)
> Can this be reproduced in later versions of PHP?

yes
Comment 6 Michael Orlitzky gentoo-dev 2015-11-07 00:29:43 UTC
@ago: is this still a problem with php-5.6.x? I've been building and running PHP and its tests on a hardened machine for a few days now -- some of them fail, but no segfaults.

It may have been fixed in the meantime. If not I'll track it down and send a report upstream.
Comment 7 Agostino Sarubbo gentoo-dev 2015-11-08 12:15:37 UTC
This is what I get:

[    0.000000] conftest[2184]: segfault at 1 ip 000003c1f673ed7b sp 000003f7289646c0 error 4 in libc-client.so.1.0.0[3c1f66ff000+105000]
[    0.000000] conftest[4293]: segfault at 0 ip 0000000000400590 sp 000003bcaa63f030 error 4 in conftest[400000+1000]
[    0.000000] conftest[4316]: segfault at 0 ip 000002e7f7b1097a sp 000003b4c1347bc8 error 4 in libc-2.21.so[2e7f7a80000+191000]
[    0.000000] conftest[16339]: segfault at 1 ip 00000281b3a38d7b sp 000003d9b9fe1d40 error 4 in libc-client.so.1.0.0[281b39f9000+105000]                                                       
[    0.000000] grsec: From 5.90.230.241: Segmentation fault occurred at 0000000000000001 in /media/data/chroot/var/tmp/portage/dev-lang/php-5.6.14/work/sapis-build/cgi/conftest[conftest:16339] uid/euid:250/250 gid/egid:250/250, parent /media/data/chroot/var/tmp/portage/dev-lang/php-5.6.14/work/sapis-build/cgi/configure[configure:16338] uid/euid:250/250 gid/egid:250/250             
[    0.000000] grsec: From 5.90.230.241: denied resource overstep by requesting 4096 for RLIMIT_CORE against limit 0 for /media/data/chroot/var/tmp/portage/dev-lang/php-5.6.14/work/sapis-build/cgi/conftest[conftest:16339] uid/euid:250/250 gid/egid:250/250, parent /media/data/chroot/var/tmp/portage/dev-lang/php-5.6.14/work/sapis-build/cgi/configure[configure:16338] uid/euid:250/250 gid/egid:250/250                                                                                                                                                                                
[    0.000000] conftest[18258]: segfault at 0 ip 0000000000400590 sp 000003a68e159420 error 4 in conftest[400000+1000]                                                                          
[    0.000000] conftest[18281]: segfault at 0 ip 000002f15079597a sp 000003f6354ab908 error 4 in libc-2.21.so[2f150705000+191000]                                                               
[    0.000000] conftest[31012]: segfault at 1 ip 000002da6dc76d7b sp 00000392cae59f00 error 4 in libc-client.so.1.0.0[2da6dc37000+105000]                                                       
[    0.000000] conftest[576]: segfault at 0 ip 0000000000400590 sp 000003e1f089b4e0 error 4 in conftest[400000+1000]                                                                            
[    0.000000] conftest[605]: segfault at 0 ip 00000351ff6cd97a sp 000003d138610928 error 4 in libc-2.21.so[351ff63d000+191000]                                                                 
[    0.000000] conftest[13435]: segfault at 1 ip 0000034314f16d7b sp 000003c189c03390 error 4 in libc-client.so.1.0.0[34314ed7000+105000]                                                       
[    0.000000] conftest[15336]: segfault at 0 ip 0000000000400590 sp 000003f06e4abc20 error 4 in conftest[400000+1000]                                                                          
[    0.000000] conftest[15384]: segfault at 0 ip 000002923c62897a sp 000003bc61a6f7e8 error 4 in libc-2.21.so[2923c598000+191000]
Comment 8 Michael Orlitzky gentoo-dev 2015-11-09 02:05:16 UTC
I'm removing @hardened from CC since I think this is unrelated.

The crash happens in libc-client:

[    0.000000] conftest[2184]: segfault at 1 ip 000003c1f673ed7b sp 000003f7289646c0 error 4 in libc-client.so.1.0.0[3c1f66ff000+105000]

which comes from net-libs/c-client. We have some other problems with c-client:

  * bug #456928
  * bug #545086

I can think of a few next steps if you feel like troubleshooting. First, you could unset USE=imap and see if the ./configure succeeds. If it does, at least we'll know that c-client is in fact the problem.

Next, you could try re-emerging c-client with LDFLAGS="-lcrypt". Maybe this is the same issue as in those two bugs? Are you using gold or another non-default linker?

Or if that doesn't work, you could try to compile the conftest program yourself. They're little tiny programs, and you can find the source code in config.log. If you build c-client with debug symbols you should be able to get a decent traceback from the crash. If you switch back to vanilla GCC that might improve things, who knows.
Comment 9 Agostino Sarubbo gentoo-dev 2015-11-09 13:38:02 UTC
> I can think of a few next steps if you feel like troubleshooting. First, you
> could unset USE=imap and see if the ./configure succeeds.

I have the same failure without USE imap.


> Next, you could try re-emerging c-client with LDFLAGS="-lcrypt". Maybe this
> is the same issue as in those two bugs? Are you using gold or another
> non-default linker?
Re-emerged, same issue. I don't use different linker.
Comment 10 Michael Orlitzky gentoo-dev 2015-11-09 17:19:39 UTC
Two of these segfaults I've fixed in bug #518964:

  https://github.com/php/php-src/pull/1626

The c-client one should be fixed in.

  https://github.com/php/php-src/pull/1627

Now we wait...
Comment 11 Michael Orlitzky gentoo-dev 2016-06-09 23:03:26 UTC
This got merged upstream when I wasn't paying attention.