Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 127712 - glib 2.10.1 possible segfaults with USE="-debug"
Summary: glib 2.10.1 possible segfaults with USE="-debug"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GNOME (show other bugs)
Hardware: All Linux
: Highest major (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 119872
  Show dependency tree
 
Reported: 2006-03-26 22:52 UTC by Kyle McFarland
Modified: 2006-03-27 13:16 UTC (History)
0 users

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


Attachments
Simple testcase (testcase.cpp,269 bytes, text/plain)
2006-03-26 22:55 UTC, Kyle McFarland
Details
slightly modified glib-2.10.1 ebuild which fixes the issue (glib-2.10.1.ebuild,1.62 KB, text/plain)
2006-03-26 22:59 UTC, Kyle McFarland
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle McFarland 2006-03-26 22:52:44 UTC
in short when --disable-debug is specified explicitly to glibs ./configure it disables basic data validity checks in some functions in glib, and in some cases causes segfaults inside of some glib functions if the right values are sent to them.

To be more specific explicitly specifying --disable-debug causes G_DISABLE_CHECKS to be defined when compiling glib (search for G_DISABLE_CHECKS in http://cvs.gnome.org/viewcvs/glib/configure.in?rev=1.499&only_with_tag=GLIB_2_10_1&view=markup ), which in turn causes g_return_if_fail and g_return_val_if_fail to do nothing basically (close to the bottom of http://cvs.gnome.org/viewcvs/glib/configure.in?rev=1.499&only_with_tag=GLIB_2_10_1&view=markup ), some functions inside of glib such as g_utf8_collate use g_return_val_if_fail to check if the value is NULL before trying to use it in a way that could cause the program to segfault (in this case attempts to access (the memory address of the string) - 1 which can break if the string pointer is NULL)

Simply not using `use_enable debug` but instead `use debug && whatever="--enable-debug"` fixes the issue for me

(I'm not sure if this applies to glib <= 2.8 as well, but it looks like it might)

emerge --info:
Portage 2.1_pre7-r1 (default-linux/x86/2006.0, gcc-4.0.2, glibc-2.4-r1, 2.6.16-gentoo i686)
=================================================================
System uname: 2.6.16-gentoo i686 Intel(R) Pentium(R) 4 CPU 3.20GHz
Gentoo Base System version 1.12.0_pre16
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.4 [disabled]
dev-lang/python:     2.4.2-r1
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-r2
sys-devel/binutils:  2.16.1-r2
sys-devel/libtool:   1.3.5, 1.5.22
virtual/os-headers:  2.6.11-r3
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-g -O2 -march=pentium4 -pipe -frerun-loop-opt -floop-optimize2"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/X11/xkb /usr/share/config /var/bind /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/texmf/web2c /etc/env.d"
CXXFLAGS="-g -O2 -march=pentium4 -pipe -frerun-loop-opt -floop-optimize2"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks fixpackages metadata-transfer sandbox sfperms splitdebug strict"
GENTOO_MIRRORS="ftp://gentoo.chem.wisc.edu/gentoo/ ftp://gentoo.mirrors.pair.com/ http://gentoo.osuosl.org/ http://distfiles.gentoo.org/ http://mirror.uni-c.dk/pub/gentoo/"
LANG="en_CA.utf8"
LC_ALL="en_CA.utf8"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /usr/local/fluidportage /home/kyle/Projects/pub-overlay /usr/local/lila-portage /home/kyle/Projects/ebuilds /usr/local/portage-gentopia"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 X a52 aac aalib acpi adns aim alsa apache2 apm arts audiofile avahi avi bash-completion bcmath beagle berkdb bitmap-fonts bonobo bzip2 bzlib cairo cdda cddb cdio cdparanoia cdr cjk cli crypt ctype cups curl curlwrappers dba dbm dbus dbx dedicated directfb dmi doc dri dts dv dvd dvdr dvdread eds emboss encode esd ethereal exif expat faad fame fastbuild fbcon ffmpeg firefox flac font-server foomaticdb force-cgi-redirect fortran freetype ftp gb gd gdbm ggi gif gimp glx gnome gphoto2 gpm gstreamer gtk gtk2 gtkhtml guile hal iconv icq idn imagemagick imlib ipv6 ithreads jabber java joystick jpeg kde latex lcms libcaca libg++ libgda libwww live mad matroska memlimit mhash mikmod mmap mmx mng mono motif mp3 mpeg msn nas ncurses nls nntp nptl nptlonly nvidia odbc ogg oggvorbis openal opengl oss pam pango pcre pdflib perl png portaudio posix python qt quicktime readline ruby samba sdk sdl session shared simplexml sndfile soap sockets softmmu speex spell spl sqlite sse sse2 ssl stream svg svga szip tcltk tcpd theora tiff tokenizer truetype truetype-fonts type1 type1-fonts udev unicode usb utf8 vcd videos vorbis win32codecs wmf wxwindows xchat xine xinerama xml xml2 xosd xpm xprint xsl xv xvid yahoo zlib elibc_glibc kernel_linux userland_GNU"
Unset:  ASFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, LDFLAGS, LINGUAS
Comment 1 Kyle McFarland 2006-03-26 22:55:03 UTC
Created attachment 83210 [details]
Simple testcase

simple testcase that should segfault with USE="-debug"
Comment 2 Kyle McFarland 2006-03-26 22:59:01 UTC
Created attachment 83211 [details]
slightly modified glib-2.10.1 ebuild which fixes the issue

thie ebuild won't specify --disable-debug with USE="-debug"

oh, and to compile the above testcase use `g++ -g $(pkg-config --cflags --libs glib-2.0) testcase.cpp -o testcase` and run it with `./testcase`
Comment 3 Kyle McFarland 2006-03-26 23:02:40 UTC
um, to correct myself the second link is supposed to be http://cvs.gnome.org/viewcvs/glib/glib/gmessages.h?rev=1.29&only_with_tag=GLIB_2_10_1&view=markup, sorry about that
Comment 4 foser (RETIRED) gentoo-dev 2006-03-27 03:37:00 UTC
afaik this is not a bug, but intended behaviour when selecting --debug. We always had a similar configure piece (with comment about it) in the older glib ebuilds (check existing 2.8), but someone changed it around after that.

This should be fixed, I don't think we should be shipping with --disable-debug, because it makes debugging as good as impossible. And it should be fixed in a rev bump.
Comment 5 Saleem Abdulrasool (RETIRED) gentoo-dev 2006-03-27 13:16:11 UTC
This is a fatal flaw in the build.  Revbump added.  Please sync and test in ~2 hours.