Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 139819 - gtk-gnutella-0.96.1 crashes on startup
Summary: gtk-gnutella-0.96.1 crashes on startup
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: High critical (vote)
Assignee: Gentoo net-p2p team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-09 14:53 UTC by Tommy McDaniel
Modified: 2007-01-12 21:09 UTC (History)
2 users (show)

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


Attachments
"strace -f" output (strace.log,291.51 KB, text/x-log)
2006-07-09 14:54 UTC, Tommy McDaniel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tommy McDaniel 2006-07-09 14:53:14 UTC
When I try to start gtk-gnutella-0.96.1, it crashes as follows:

tommstein@Morpheus ~ $ gtk-gnutella
06-07-09 17:33:50 (MESSAGE): language code: "en"
06-07-09 17:33:50 (MESSAGE): using locale character set "UTF-8"
06-07-09 17:33:50 (MESSAGE): primary filename character set "UTF-8"
... [snipped lines, thanks to the apparently new comment size limit]
...
06-07-09 17:33:50 (WARNING): config file, line 107: unknown keyword 'downloads_divider_pos', ignored

Code should not have been reached in host_addr.c:332
Trace/breakpoint trap
tommstein@Morpheus ~ $

If one runs gtk-gnutella through strace, however, one gets the following output:

tommstein@Morpheus ~ $ strace -f -o strace.log gtk-gnutella
06-07-09 17:39:27 (MESSAGE): language code: "en"
06-07-09 17:39:27 (MESSAGE): using locale character set "UTF-8"
06-07-09 17:39:27 (MESSAGE): primary filename character set "UTF-8"
... [snipped lines, thanks to the apparently new comment size limit]
...
06-07-09 17:39:27 (WARNING): config file, line 107: unknown keyword 'downloads_divider_pos', ignored
06-07-09 17:39:27 (WARNING): searches file does not exist: /home/tommstein/.gtk-gnutella/searches.xml
06-07-09 17:39:27 (WARNING): retrieving searches from /home/tommstein/.gtk-gnutella/searches.xml.orig instead
gtk-gnutella: stack smashing attack in function search_gui_menu_select_helper()
tommstein@Morpheus ~ $

So there seems to be some stack smashing going on that otherwise doesn't get reported (unless running the program through strace causes it; the two crashes do seem completely unrelated). I will attach that strace.log file after this is filed. The following is my emerge --info:

Portage 2.1.1_pre2-r2 (default-linux/amd64/2005.0, gcc-3.4.5, glibc-2.3.6-r3, 2.6.16-gentoo-r9 x86_64)
=================================================================
System uname: 2.6.16-gentoo-r9 x86_64 AMD Opteron(tm) Processor 246
Gentoo Base System version 1.6.14
dev-lang/python:     2.3.5-r2, 2.4.2
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     [Not Present]
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1-r2
sys-devel/gcc-config: 1.3.13-r2
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=opteron -O3 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/terminfo"
CXXFLAGS="-march=opteron -O3 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="en_US.utf8"
LC_ALL="en_US.utf8"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="amd64 X Xaw3d a52 aac aalib accessibility acl acpi adns aim alsa apache2 arts audiofile avi bash-completion bcmath berkdb bidi bitmap-fonts bluetooth bonobo bzlib calendar canna cdb cdparanoia cdr chasen cjk cli crypt cscope ctype cups curl curlwrappers db2 dba dbase dbm dbx dedicated dga dio directfb divx4linux dlloader doc dri dv dvb dvd dvdr dvdread eds emacs emacs-w3 emboss emul-linux-x86 encode esd ethereal evo examples exif expat fam fastcgi fbcon ffmpeg flac flash flatfile foomaticdb fortran freetds freewnn ftp gb gcj gd gdbm geoip ggi gif ginac glut gmp gnome gnustep gnutls gphoto2 gpm gps gstreamer gtk gtk2 gtkhtml guile hal hardened hardenedphp howl hyperwave-api iconv icq imagemagick imap imlib inifile innodb interbase iodbc ipv6 isdnlog jabber jack javascript joystick jpeg kde kdeenablefinal kerberos krb4 ladcca lcms ldap leim libcaca libg++ libgda libwww lirc lm_sensors lzw lzw-tiff m17n-lib mad maildir mailwrapper matroska mbox mcal mcve memlimit mhash migemo mikmod milter mime ming mmap mng mnogosearch motif mozilla mp3 mpeg mpi msession msql mssql mule mysql mysqli nas ncurses neXt netcdf nis nls nocd nptl oci8 odbc offensive ofx ogg openal opengl oracle oracle7 osc oscar oss ovrimos pam pcntl pcre pda pdflib perl php plotutils png portaudio posix postgres ppds pppd prelude python qdbm qt qt3 qt4 quicktime readline recode reflection ruby samba sapdb sasl scanner sdl session sharedext sharedmem shorten simplexml skey slang slp smartcard sndfile snmp soap sockets socks5 source sox speex spell spl sqlite ssl svg symlink sysvipc szip tcltk tcpd tetex theora threads tidy tiff tokenizer truetype truetype-fonts type1-fonts unicode usb v4l vcd vhosts videos vorbis wddx wifi wmf wxwindows xface xine xml xml2 xmlrpc xmms xorg xosd xpm xprint xsl xv xvid yahoo yaz zeo zlib elibc_glibc input_devices_keyboard input_devices_mouse input_devices_evdev kernel_linux userland_GNU"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, LINGUAS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 Tommy McDaniel 2006-07-09 14:54:57 UTC
Created attachment 91318 [details]
"strace -f" output
Comment 2 Tommy McDaniel 2006-07-23 08:25:55 UTC
When I compiled the program after adding "-g -nopie" to my CFLAGS and setting FEATURES="nostrip", and using a vanilla GCC since otherwise it wouldn't compile, the program runs fine. The second bug, the one that came out in strace, is addressed by the patch mentioned here in the gtk-gnutella IRC channel:

CIA-11| cbiere * r11367 /trunk/gtk-gnutella/src/ui/gtk/gtk2/search.c: 
CIA-11| * search_gui_menu_select_helper(): Fixed bug: The column contains an integer
CIA-11|  casted to a pointer (G_TYPE_POINTER); not an integer (G_TYPE_INT). Thus
CIA-11|  this causes a crash on machines where sizeof(int) != sizeof(void *).
Cyclonus| tommstein - that's the patch: svn diff -r11366:11367 src/ui/gtk/gtk2/search.c

So there is a patch in Subversion that we could try to apply. Who knows what the first bug is though.
Comment 3 Hans de Graaff gentoo-dev Security 2006-12-02 00:19:26 UTC
Could you try again with gtk-gnutella 0.96.3? There has been additional clean-up of types, casts, and such upstream, so these problems may have gone away in the meantime. 

I've just added gtk-gnutella 0.96.3 to portage.
Comment 4 Tommy McDaniel 2006-12-02 19:23:49 UTC
Still crashes (tested on my laptop this time, since my desktop is currently dead):

tommstein@SuperstarLaptop ~ $ gtk-gnutella
06-12-02 22:18:56 (MESSAGE): language code: "en"
06-12-02 22:18:56 (MESSAGE): using locale character set "ANSI_X3.4-1968"
06-12-02 22:18:56 (MESSAGE): primary filename character set "UTF-8"
06-12-02 22:18:56 (MESSAGE): additional filename character set "ANSI_X3.4-1968"
06-12-02 22:18:56 (MESSAGE): gtk-gnutella/0.96.3 (2006-11-09; r12293; GTK2; Linux x86_64)
06-12-02 22:18:56 (MESSAGE): Could not open connection to DBus bus: Unable to determine the address of the message bus (try 'man dbus-launch' and 'man dbus-daemon' for help)
06-12-02 22:18:56 (WARNING): can't read file "/home/tommstein/.gtk-gnutella/config_gnet": No such file or directory

** ERROR **: file host_addr.h: line 188 (host_addr_initialized): should not be reached
aborting...
Aborted
tommstein@SuperstarLaptop ~ $
Comment 5 Hans de Graaff gentoo-dev Security 2006-12-03 01:28:25 UTC
This error indicates that gtk-gnutella tries to open a socket to an address that is neither local, IPv4 or IPv6, which normally should not happen.

One possible cause is that the files in your .gtk-gnutella directory are corrupt and gtk-gnutella encounters an address there that doesn't match expectations. I can suggest to things to try:

1. Try moving your .gtk-gnutella directory out of the way and see if this also happens on a fresh start.
2. Try to get a backtrace from gdb so that we can determine where the offending address comes from.
Comment 6 Tommy McDaniel 2006-12-05 02:14:14 UTC
When I removed my .gtk-gnutella directory, nothing changed.

I then tried getting the backtrace. I basically did the same thing I did in comment #2: I switched away from hardened GCC, I set FEATURES="nostrip", and I added -g to CFLAGS. When I deleted .gtk-gnutella and ran it, it again ran normally, like in comment #2. This is the (seemingly useless) output from that run through GDB:

tommstein@SuperstarLaptop ~ $ gdb gtk-gnutella
GNU gdb 6.4
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu"...(no debugging symbols found)
Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) run
Starting program: /usr/bin/gtk-gnutella
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
---Type <return> to continue, or q <return> to quit---
(no debugging symbols found)
(no debugging symbols found)
06-12-03 06:11:15 (MESSAGE): language code: "en"
06-12-03 06:11:15 (MESSAGE): using locale character set "ANSI_X3.4-1968"
06-12-03 06:11:15 (MESSAGE): primary filename character set "UTF-8"
06-12-03 06:11:15 (MESSAGE): additional filename character set "ANSI_X3.4-1968"
06-12-03 06:11:18 (MESSAGE): gtk-gnutella/0.96.3 (2006-11-09; r12293; GTK2; Linux x86_64)
06-12-03 06:11:18 (MESSAGE): Could not open connection to DBus bus: Unable to determine the address of the message bus (try 'man dbus-launch' and 'man dbus-daemon' for help)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
06-12-03 06:11:18 (WARNING): creating configuration directory "/home/tommstein/.gtk-gnutella"
06-12-03 06:11:18 (WARNING): can't read file "/home/tommstein/.gtk-gnutella/config_gnet": No such file or directory
06-12-03 06:11:18 (WARNING): gnutls_certificate_set_x509_key_file() failed: Error while reading file.
06-12-03 06:11:18 (WARNING): [TLS cache] unable to retrieve: no alternate locations known
06-12-03 06:11:18 (WARNING): [hosts] unable to retrieve: no alternate locations known
06-12-03 06:11:18 (WARNING): [hosts] unable to retrieve: no alternate locations known
06-12-03 06:11:18 (WARNING): [hostile IP addresses (private)] unable to retrieve: no alternate locations known
06-12-03 06:11:18 (WARNING): [Spam database] unable to retrieve: no alternate locations known
06-12-03 06:11:18 (WARNING): can't read file "/home/tommstein/.gtk-gnutella/sha1_cache": No such file or directory
06-12-03 06:11:18 (WARNING): [download mesh] unable to retrieve: no alternate locations known
06-12-03 06:11:18 (WARNING): [banned mesh] unable to retrieve: no alternate locations known
06-12-03 06:11:18 (WARNING): [Host Whitelist] unable to retrieve: no alternate locations known
06-12-03 06:11:18 (WARNING): [PARQ upload queue data] unable to retrieve: no alternate locations known
06-12-03 06:11:18 (WARNING): bitzi_init: failed to rename /home/tommstein/.gtk-gnutella/bitzi.xml to /home/tommstein/.gtk-gnutella/bitzi.xml.orig (No such file or directory)
06-12-03 06:11:18 (WARNING): can't read file "/home/tommstein/.gtk-gnutella/config_gui": No such file or directory
(no debugging symbols found)
06-12-03 06:11:18 (WARNING): searches file does not exist: /home/tommstein/.gtk-gnutella/searches.xml
06-12-03 06:11:18 (WARNING): [fileinfo database] unable to retrieve: no alternate locations known
06-12-03 06:11:18 (WARNING): [downloads] unable to retrieve: no alternate locations known
06-12-03 06:11:28 (WARNING): could not stat "/home/tommstein/.gtk-gnutella/config_gnet": No such file or directory
06-12-03 06:11:28 (WARNING): could not stat "/home/tommstein/.gtk-gnutella/config_gui": No such file or directory

Program exited normally.
(gdb)
Comment 7 Hans de Graaff gentoo-dev Security 2006-12-09 06:06:01 UTC
It looks like the problem is that gtk-gnutella does not work well with hardened GCC. I don't have any experience with hardened GCC, but it looks like add -nopie to the CFLAGS may work around the problem? Could you confirm that gtk-gnutella compiles and works correctly in this way?
Comment 8 Raúl Porcel (RETIRED) gentoo-dev 2007-01-12 21:09:43 UTC
Reopen with the needed info.