Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 90637 - any usage of net-snmp segfaults (init_usm_post_config)
Summary: any usage of net-snmp segfaults (init_usm_post_config)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal
Assignee: Gentoo Netmon project
URL:
Whiteboard:
Keywords:
: 93912 105006 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-04-27 10:15 UTC by Doug
Modified: 2006-01-20 01:32 UTC (History)
4 users (show)

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


Attachments
core dump (core,1.38 MB, application/octet-stream)
2005-04-27 17:21 UTC, Doug
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Doug 2005-04-27 10:15:04 UTC
After upgrading to 2005.0, when cli php is emerged the created php executable seg faults when run causing the following during the install process:

Installing PHP CLI binary:        /var/tmp/portage/php-4.3.11/image//usr/bin/
Installing PHP CLI man page:      /var/tmp/portage/php-4.3.11/image//usr/share/man/man1/
Installing shared extensions:     /var/tmp/portage/php-4.3.11/image//usr/lib/php/extensions/no-debug-non-zts-20020429/
Installing PEAR environment:      /var/tmp/portage/php-4.3.11/image//usr/lib/php/php/
make[1]: *** [install-pear-installer] Segmentation fault
make: *** [install-pear] Error 2

!!! ERROR: dev-php/php-4.3.11 failed.
!!! Function php-sapi_src_install, Line 561, Exitcode 2


Reproducible: Always
Steps to Reproduce:
1. emerge php

Actual Results:  
PHP not installed.

Expected Results:  
PHP should have been installed.

I have done all that I can think of.  Re-emerged both gcc and glibc.  Did a
revdep-rebuild.  Please let me know what additional information is needed.
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2005-04-27 10:27:06 UTC
Always post emerge --info output when reporting bugs.
Comment 2 Doug 2005-04-27 10:31:05 UTC
Portage 2.0.51.19 (default-linux/x86/2005.0, gcc-3.3.5-20050130, glibc-2.3.4.20041102-r1, 2.4.26-gentoo-r11 i686)
=================================================================
System uname: 2.4.26-gentoo-r11 i686 Celeron (Mendocino)
Gentoo Base System version 1.4.16
Python:              dev-lang/python-2.3.4-r1 [2.3.4 (#1, Feb 10 2005, 00:35:37)]
dev-lang/python:     2.3.4-r1
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.5, 1.8.5-r3, 1.6.3, 1.7.9-r1, 1.4_p6, 1.9.4
sys-devel/binutils:  2.15.92.0.2-r7
sys-devel/libtool:   1.5.14
virtual/os-headers:  2.6.8.1-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-march=pentium2 -O3 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/bind /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -mcpu=i686 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://gentoo.nestegg.com http://www.ibiblio.org/gentoo"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://gentoo.nestegg.com/gentoo-portage"
USE="x86 alsa apache2 apm arts avi berkdb bitmap-fonts crypt emboss encode foomaticdb fortran gdbm gif gnome gpm gtk gtk2 imlib ipv6 jpeg kde libg++ libwww mad mikmod motif mp3 mpeg mysql ncurses nls oggvorbis opengl oss pam pdflib perl png python quicktime readline sdl slang snmp spell ssl svga tcpd tiff truetype truetype-fonts type1-fonts xmms xv zlib"
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTDIR_OVERLAY
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2005-04-27 14:03:26 UTC
You forgot to reopen this one... ;-)
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-04-27 14:27:38 UTC
please repeat the emerge with debugging CFLAGS, and provide a backtrace for the php binary.
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-04-27 14:53:54 UTC
debugging flags:
USE="debug"
CFLAGS="-march=pentium2 -O2 -pipe -ggdb3"
CXXFLAGS="-march=pentium2 -O2 -pipe -ggdb3"
FEATURES="nostrip"
Comment 6 Doug 2005-04-27 15:46:39 UTC
After emerging with debug there's no traceback:

Installing PEAR environment:      /var/tmp/portage/php-4.3.11/image//usr/lib/php/php/
make[1]: *** [install-pear-installer] Segmentation fault
make: *** [install-pear] Error 2
Comment 7 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-04-27 15:58:24 UTC
enable core dumps "ulimit -c unlimited"
and then run gdb against the php binary and the core dump.
Comment 8 Doug 2005-04-27 17:21:43 UTC
Created attachment 57441 [details]
core dump
Comment 9 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-04-27 17:48:47 UTC
the core dump is entirely useless on it's own.
you MUST run gdb against it to produce a backtrace, that is then usable.

gdb /var/tmp/portage/..../php core
Comment 10 Doug 2005-04-27 18:16:17 UTC
Is this what we're after?

(gdb) bt
#0  0x40843be0 in init_usm_post_config () from /usr/lib/libnetsnmp.so.5
#1  0x4082a753 in snmp_call_callbacks () from /usr/lib/libnetsnmp.so.5
#2  0x4081fb27 in read_premib_configs () from /usr/lib/libnetsnmp.so.5
#3  0x407fc266 in init_snmp () from /usr/lib/libnetsnmp.so.5
#4  0x08120946 in zm_startup_snmp (type=1, module_number=12) at /var/tmp/portage/php-4.3.11/work/php-4.3.11/ext/snmp/snmp.c:186
#5  0x08200a7f in zend_startup_module (module=0x83c7340) at /var/tmp/portage/php-4.3.11/work/php-4.3.11/Zend/zend_API.c:1006
#6  0x081cb280 in php_startup_extensions (ptr=0x83d18ac, count=0) at /var/tmp/portage/php-4.3.11/work/php-4.3.11/main/main.c:1045
#7  0x08222cdb in php_startup_internal_extensions () at internal_functions_cli.c:129
#8  0x081c9c8b in php_module_startup (sf=0x83aebc4, additional_modules=0x0, num_additional_modules=0) at /var/tmp/portage/php-4.3.11/work/php-4.3.11/main/main.c:1218
#9  0x082216f0 in main (argc=1, argv=0xbffffb14) at /var/tmp/portage/php-4.3.11/work/php-4.3.11/sapi/cli/php_cli.c:582
Comment 11 Doug 2005-04-27 18:48:38 UTC
Based on the backtrace I found the running an snmp command also seg faults.  Re-emerged net-snmp with the same results.  Now rebuilding with debugging.
Comment 12 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-04-27 19:07:54 UTC
yes, that gdb backtrace data is exactly what I was wanting
this is something broken in net-snmp.

if you could rebuild net-snmp with the debugging flags I provided, and repeat the backtrace procedure again, we should get some line numbers into the net-snmp stuff for the source of the bug.
Comment 13 Doug 2005-04-27 19:18:53 UTC
Core was generated by `snmpget'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libnetsnmp.so.5...done.
Loaded symbols for /usr/lib/libnetsnmp.so.5
Reading symbols from /usr/lib/libcrypto.so.0.9.7...done.
Loaded symbols for /usr/lib/libcrypto.so.0.9.7
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
#0  init_usm_post_config (majorid=0, minorid=3, serverarg=0x0, clientarg=0x0) at snmpusm.c:2818
2818    snmpusm.c: No such file or directory.
        in snmpusm.c
(gdb) bt
#0  init_usm_post_config (majorid=0, minorid=3, serverarg=0x0, clientarg=0x0) at snmpusm.c:2818
#1  0x40081753 in snmp_call_callbacks (major=0, minor=3, caller_arg=0x0) at callback.c:224
#2  0x40076b27 in read_premib_configs () at read_config.c:861
#3  0x40053266 in init_snmp (type=0x400a923c "snmpapp") at snmp_api.c:818
#4  0x40071504 in snmp_parse_args (argc=1, argv=0xbffffb14, session=0xbffff9a0, localOpts=0x8049188 "C:", proc=0x8048fe0 <optProc>) at snmp_parse_args.c:596
#5  0x08048a97 in main (argc=1, argv=0xbffffb14) at snmpget.c:133
Comment 14 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-04-27 21:13:16 UTC
ok, I'm passing this over to the netmon folk for net-snmp, since it's NOT a php bug.
Comment 15 Aaron Walker (RETIRED) gentoo-dev 2005-05-17 05:57:01 UTC
Doug, mind posting the snmpget command you used to get that backtrace?
Comment 16 Doug 2005-05-17 07:03:49 UTC
It was snmpget with no options.
Comment 17 Aaron Walker (RETIRED) gentoo-dev 2005-05-17 07:14:56 UTC
hmmm.. snmpget with no options only shows the usage.  That really leads me to
believe something's really funky on your end.  Anyhow, I'm unable to reproduce
that here.
Comment 18 Doug 2005-05-17 09:08:08 UTC
This happened when upgrading to 2005.0.  I'm guessing that some library needs to
be rebuilt, but which one?  This is happening on a production machine, so it's
difficult for me to go off and rebuild everything.  What is happening at that
point in the code?  Does that give any clue as to what might need to be rebuilt?
Comment 19 Aaron Walker (RETIRED) gentoo-dev 2005-05-17 09:28:52 UTC
have you rebuilt net-snmp itself?
Comment 20 Doug 2005-05-17 09:37:23 UTC
Yes, along with glibc and gcc.  Also a revdep-rebuild.
Comment 21 Daniel Black (RETIRED) gentoo-dev 2005-05-25 06:22:03 UTC
see anthing here http://sourceforge.net/tracker/?group_id=12694&atid=112694 
looking similar? 
Comment 22 Doug 2005-06-13 20:35:12 UTC
Here's some more info.

First I was able to find time to do an "emerge -e system" which did not fix the
problem.

I did a little snooping and in the routine init_usm_post_config where this is
crashing and it's possible for usm_create_initial_user to return NULL.  However,
this is immediately followed by: SNMP_FREE(noNameUser->engineID); which would be
a bad address if noNameUser is NULL.  Adding a check for this case fixes the
crash and appears to make things work correctly, but I don't know why I have
this problem on one machine only.  Any thoughts?  In any case, looks like a bug
that should be fixed.
Comment 23 Sebastian Bergmann (RETIRED) gentoo-dev 2005-07-02 00:44:11 UTC
*** Bug 93912 has been marked as a duplicate of this bug. ***
Comment 24 Steven Coutts 2005-09-16 07:22:20 UTC
I have a two machines this is happening on, one is a production machine, I was 
able to disable the snmp USE flag to get PHP to work on the production machine.

I can mess about with the other machine, so I will do some backtraces etc and 
let you know what I come up with.
Comment 25 Jakub Moc (RETIRED) gentoo-dev 2005-09-16 08:02:24 UTC
*** Bug 105006 has been marked as a duplicate of this bug. ***
Comment 26 Hunter Cook 2005-10-06 18:31:24 UTC
I also had a machine that was doing this, several months ago, and I fixed it by
disabling the snmp use flag. Somebody in #gentoo-apache suggested it. However,
today I find that simple snmpwalk commands also segfault when run locally
against my snmpd. Is this related?
Comment 27 Sebastian Bergmann (RETIRED) gentoo-dev 2006-01-20 01:32:01 UTC
dev-php/php, dev-php/mod_php, and dev-php/php-cgi have been replaced by
dev-lang/php.

Please upgrade (following the guide at
http://svn.gnqs.org/projects/gentoo-php-overlay/file/docs/php-upgrading.html?format=raw)
to the new-style PHP package and open a new bug if the problem persists.

Thank you.