GNOME Bugzilla – Bug 673418
Segmentation fault in xmllint
Last modified: 2017-09-07 18:52:09 UTC
On my gentoo system running dev-libs/libxml2 2.7.8-r4 (and/or -r5, tried both) xmllint generates segfaults when an xml file is passed to it. The problem became aparent while trying to emerge package x11-misc/shared-mime-info-1.0, which fails on: if test -e ./freedesktop.org.xml; then \ xmllint --noout --valid ./freedesktop.org.xml || exit 1; \ else \ xmllint --noout --valid ./freedesktop.org.xml || exit 1; \ fi; \ if test -d .git/ && test -x ./update-mime-database && test -d ./mime-db-tests ; then \ ./update-mime-database mime-db-tests/ ; \ fi /bin/sh: line 7: 4366 Segmentation fault xmllint --noout --valid ./freedesktop.org.xml After some more research it turns out xmllint always fails when an xml file is passed to it, regardless of params. Running only "xmllint" does work, and shows the help screen. I tried re-emerging libxml2 with various USE flags, but to no avail. Building the libxml2 package always give the (probably known) notification: * QA Notice: Package triggers severe warnings which indicate that it * may exhibit random runtime failures. * xmlIO.c:1179:5: warning: implicit declaration of function ‘gzopen64’ So that seemed like a good place to start searching, with result: ldd /usr/bin/xmllint linux-vdso.so.1 => (0x00000307eb4f7000) libreadline.so.6 => /lib64/libreadline.so.6 (0x00000307eb08f000) libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00000307ead2a000) libc.so.6 => /lib64/libc.so.6 (0x00000307ea9a8000) libncurses.so.5 => /lib64/libncurses.so.5 (0x00000307ea74f000) libdl.so.2 => /lib64/libdl.so.2 (0x00000307ea54b000) libz.so.1 => /lib64/libz.so.1 (0x00000307ea335000) libm.so.6 => /lib64/libm.so.6 (0x00000307ea0b4000) /lib64/ld-linux-x86-64.so.2 (0x00000307eb2da000) objdump -T /lib64/libz.so.1 | grep gzopen64 000000000000d63a g DF .text 000000000000003a ZLIB_1.2.3.3 gzopen64 So the implicitly declared function should be there and available. From this point forth my debugging skills fail me and I don't know how to proceed or get more useful information. I'm not sure if this is a general error, as comparable servers don't exhibit the same segfault. It might just be this system, though I have rebuilt the entire toolchain and everything seems fine. System information: emerge --info Portage 2.1.10.49 (hardened/linux/amd64, gcc-4.5.3, glibc-2.13-r4, 3.2.2-hardened-r1-RMZv1si x86_64) ================================================================= System uname: Linux-3.2.2-hardened-r1-RMZv1si-x86_64-Intel-R-_Xeon-TM-_CPU_3.40GHz-with-gentoo-2.0.3 Timestamp of tree: Tue, 03 Apr 2012 08:00:01 +0000 app-shells/bash: 4.2_p20 dev-java/java-config: 2.1.11-r3 dev-lang/python: 2.7.2-r3, 3.2.2 dev-util/cmake: 2.8.6-r4 dev-util/pkgconfig: 0.26 sys-apps/baselayout: 2.0.3 sys-apps/openrc: 0.9.8.4 sys-apps/sandbox: 2.5 sys-devel/autoconf: 2.13, 2.68 sys-devel/automake: 1.4_p6-r1, 1.11.1 sys-devel/binutils: 2.21.1-r1 sys-devel/gcc: 4.5.3-r2 sys-devel/gcc-config: 1.5-r2 sys-devel/libtool: 2.4-r1 sys-devel/make: 3.82-r1 sys-kernel/linux-headers: 3.1 (virtual/os-headers) sys-libs/glibc: 2.13-r4 Repositories: gentoo x-portage ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="*" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=nocona -O2 -pipe " CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa /var/bind /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/apache2-php5.4/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-march=nocona -O2 -pipe " DISTDIR="/usr/portage/distfiles" FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch" FFLAGS="" GENTOO_MIRRORS="ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo http://ftp.snt.utwente.nl/pub/os/linux/gentoo ftp://mirror.leaseweb.com/gentoo/ http://mirror.leaseweb.com/gentoo/ " LANG="en_US.UTF-8" LC_ALL="en_US.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --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="acl amd64 apache2 auth_digest bash bash-completion bzip2 caps cli cracklib crypt ctype cxx dba dri ftp gd gdbm gpm hardened iconv imap innodb intl ipv6 ithreads jpeg jpeg2k justify memcache memcached mmx modules mudflap multilib mysql ncurses nls nptl nptlonly openmp pam pax_kernel pcre php pic png pppd raw readline session slang snmp sockets sse sse2 ssl suexec svg sysfs tcpd threads tiff unicode urandom usagi valias vhosts vpopmail wmf xml xorg 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 authn_alias authn_anon authn_dbm authn_dbd 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 setenvif speling ssl status unique_id usertrack auth_basic auth_digest rewrite userdir vhost_alias cgid bw bandwidth" APACHE2_MPMS="prefork" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" 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" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-4" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" 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, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Well, got my emerge working at least by doing the following: - Pulled the HEAD for libxml2 from git - Compiled and installed it in /usr/local - Downgraded sys-libs/zlib from 1.2.6 to 1.2.5-r2 - No more segfaults Removing the /usr/local/bin version of xmllint (thus reverting to the system version, 2.7.8-r5) still results in segfaults though. Probably something that has already been patched for zlib 1.2.5 then, but that's still broken for zlib 1.2.6. Gdb backtraced to a gzdirect / gzopen line in xmlIO, but I was dumb enough not to save the output and removed debugging symbols afterwards when rebuilding the normal system configuration.