Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 121348 - Stack smashing attack in wine compiled with gcc-3.4.4
Summary: Stack smashing attack in wine compiled with gcc-3.4.4
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Wine Maintainers
URL:
Whiteboard:
Keywords:
: 203683 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-02-02 12:42 UTC by Anders Hellgren
Modified: 2007-12-29 15:07 UTC (History)
6 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Hellgren gentoo-dev 2006-02-02 12:42:26 UTC
Wine compiled with hardened gcc-3.4.4 aborts with a stack smashing attack in function WineEngInit(). Tested with version 0.9.6, 0.9.5-r1, 20050930. Wine-0.9.6 works if compiled with gcc-3.3.6.

Reproducible: Always
Steps to Reproduce:
1. # gcc-config -l
 [1] i686-pc-linux-gnu-3.3.6
 [2] i686-pc-linux-gnu-3.3.6-hardenednopie
 [3] i686-pc-linux-gnu-3.3.6-hardenednopiessp
 [4] i686-pc-linux-gnu-3.3.6-hardenednossp
 [5] i686-pc-linux-gnu-3.3.6-vanilla
 [6] i686-pc-linux-gnu-3.4.4 *
 [7] i686-pc-linux-gnu-3.4.4-hardenednopie
 [8] i686-pc-linux-gnu-3.4.4-hardenednopiessp
 [9] i686-pc-linux-gnu-3.4.4-hardenednossp
 [10] i686-pc-linux-gnu-3.4.4-vanilla
2. # emerge -av wine

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild   R   ] app-emulation/wine-0.9.6  +X +alsa -arts +cups +debug -esd +gif +glut -jack +jpeg +lcms -ldap -nas +ncurses +opengl +oss -scanner +truetype +xml2 0 kB
3. $ wine-pthread somewindowsapp.exe

Actual Results:
wine-pthread: stack smashing attack in function WineEngInit()
Aborted

Expected Results:
somewindowapp.exe started normally.


$ emerge --info
Portage 2.0.54 (hardened/x86/2.6, gcc-3.4.4, glibc-2.3.5-r2, 2.6.14-hardened-r3 i686)
=================================================================
System uname: 2.6.14-hardened-r3 i686 AMD Athlon(tm) XP 1800+
Gentoo Base System version 1.6.14
dev-lang/python:     2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
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
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O2 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/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/ /var/qmail/alias /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=athlon-xp -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig collision-protect distlocks sandbox sfperms strict userpriv usersandbox"
GENTOO_MIRRORS="http://ds.thn.htu.se/linux/gentoo http://trumpetti.atm.tut.fi/gentoo http://mirror.pudas.net/gentoo http://gentoo.osuosl.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LANG="C"
PKGDIR="/usr/portage//packages/x86/"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage/"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.se.gentoo.org/gentoo-portage"
USE="3dnow X acl acpi alsa audiofile berkdb bitmap-fonts bzip2 cdr crypt cups curl dlloader dts encode ethereal exif expat fam flac gd gdbm gif glut gmp gnome gpm gstreamer gtk gtk2 gtkhtml guile hardened idn imagemagick java jikes jpeg lcms libwww mad mikmod mmx mng mp3 mpeg mysql ncurses nls nptl ogg oggvorbis opengl oss pam pcre perl pic png python quicktime readline sdl speex spell sse ssl svga tcpd tetex tiff truetype truetype-fonts type1-fonts udev unicode userlocales vorbis win32codecs x86 xml2 xmms xv zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LC_ALL, LDFLAGS, LINGUAS, MAKEOPTS
Comment 1 César Fernández 2006-04-03 08:15:11 UTC
Same problem here, even with vanilla gcc 3.4.6

Portage 2.1_pre7-r4 (default-linux/x86/2005.0, gcc-3.4.6, glibc-2.3.6-r3, 2.6.16-gentoo-r1 i686)
=================================================================
System uname: 2.6.16-gentoo-r1 i686 AMD Athlon(TM) XP 1800+
Gentoo Base System version 1.12.0_pre16
ccache version 2.4 [enabled]
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.5.22
virtual/os-headers:  2.6.11-r3
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -mfpmath=sse -mmmx -msse -m3dnow -ffast-math -funroll-loops -O2 -ftracer -fno-ident -fomit-frame-pointer -pipe"
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/share/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/eselect/compiler /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/env.d"
CXXFLAGS="-march=athlon-xp -mfpmath=sse -mmmx -msse -m3dnow -ffast-math -funroll-loops -O2 -ftracer -fno-ident -fomit-frame-pointer -pipe -fvisibility-inlines-hidden"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig ccache distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="es_ES.UTF-8"
LC_ALL="es_ES.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--enable-new-dtags -Wl,--sort-common -s -Wl,--as-needed"
LINGUAS="es-ES es"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 16bit 3dnow 3dnowext 7zip S3TC X a52 aac aalib acpi alsa amr asf bash-completion berkdb bidi bzip2 cairo canvas cdda cddb cdparanoia chroot cjk clock-screen crypt cscope css cups curl daap dbus dlloader dri dts dvd dvdr dvdread ecc edl eds erandom exif faac faad fam fbcon ffmpeg flac font-server fontconfig foomaticdb foreign-sysvinit freetype gdbm gif gimpprint glibc-omitfp glitz gmp gnutls gphoto2 gpm graphviz gs gtk2 hal hardened hpn icecast iconv idn imagemagick imlib imlib2 immqt-bc ipv6 isdnlog ithreads jabber java javascript jbig jce jikes jpeg jpeg2k justify kde kdeenablefinal kipi lcms libcaca libg++ libwww linguas_es live lm_sensors logitech-mouse logrotate lzo lzw-tiff mad matroska md5sum mikmod mmap mmx mmxext mng mod modplug monkey mouse moznocompose moznoirc moznomail mozsvg mp3 mp4 mpeg mpeg4 mpi mplayer msn musepack musicbrainz mysql mysqli mzscheme ncurses network nls no-old-linux no_wxgtk1 nomac nomalloccheck nomotif nptl nptlonly nsplugin ogg oggvorbis openexr opengl pam pccts pdflib perl physfs pic png ppds pppd python qt quicktime rdesktop readline real rtc ruby sasl screen sftplogging shorten slp speex spell srvdir sse ssl stencil-buffer svg symlink tcpd tga theora threads tiff toolbar truetype truetype-fonts udev unicode urandom usb userlocales utf8 vcd vhosts vim-with-x visualization vorbis win32codecs wmf x264 xcomposite xine xml xpm xrandr xscreensaver xv xvid zeroconf zip zlib elibc_glibc input_devices_keyboard input_devices_mouse kernel_linux linguas_es-ES userland_GNU video_cards_fbdev video_cards_vesa video_cards_nvidia"
Unset:  ASFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, MAKEOPTS
Comment 2 Michal Suchanek 2006-06-04 14:25:24 UTC
How can you get a ssp error with vanilla gcc?

[ebuild   R   ] app-emulation/wine-0.9.8-r1  +X +alsa -arts +cups +debug -esd +gif +glut -jack +jpeg +lcms +ldap +nas +ncurses +opengl +oss -scanner +truetype +xml

wine-pthread: stack smashing attack in function WineEngInit()
Aborted

gcc-select -l
 [1] i686-pc-linux-gnu-3.3.6
 [2] i686-pc-linux-gnu-3.3.6-hardenednopie
 [3] i686-pc-linux-gnu-3.3.6-hardenednopiessp
 [4] i686-pc-linux-gnu-3.3.6-hardenednossp
 [5] i686-pc-linux-gnu-3.3.6-vanilla
 [6] i686-pc-linux-gnu-3.4.4 *
 [7] i686-pc-linux-gnu-3.4.4-hardenednopie
 [8] i686-pc-linux-gnu-3.4.4-hardenednopiessp
 [9] i686-pc-linux-gnu-3.4.4-hardenednossp
 [10] i686-pc-linux-gnu-3.4.4-vanilla
 [11] i686-pc-linux-gnu-4.0.2


Portage 2203-svn (default-linux/x86/2005.1, gcc-3.4.4, glibc-2.3.6-r2, 2.6.16-gentoo-r6-src i686)
=================================================================
System uname: 2.6.16-gentoo-r6-src i686 AMD Athlon(tm) XP 1800+
Gentoo Base System version 1.6.14
ccache version 2.3 [enabled]
dev-lang/python:     2.3.5-r2, 2.4.2
dev-python/pycrypto: [Not Present]
dev-util/ccache:     2.3
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.12
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
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=athlon-xp -mfpmath=sse -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/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/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/eselect/compiler /etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=athlon-xp -mfpmath=sse -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig ccache distlocks maketest nostrip sandbox sfperms strict test"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LANG="en_US.UTF-8"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 3dnow 3dnowext X a52 aac acpi aim alsa apache2 audiofile avi bcmath berkdb bitmap-fonts bzip2 caps cdb cdparanoia cdr cjk cli cpdflib crypt cscope ctype cups curl dbus dbx debug dedicated dga dio dlloader doc dri dts dv dvb dvd dvdr dvdread emboss encode erandom ethereal examples exif expat fam fbcon ffmpeg flac flash flatfile fontconfig foomaticdb fortran ftp gb gcj gd gdbm ggi gif ginac glibc-omitfp glut gmp gnutls gphoto2 gpm gstreamer gtk gtk2 gtkhtml hal hardened howl iconv icq idn ieee1394 imagemagick imap imlib inifile ipv6 isdnlog jabber java javascript jpeg kdexdeltas kerberos lcms ldap libg++ libwww linuxthreads-tls live lm_sensors lua lzo mad maildir matroska matrox mbox mikmod mime ming mmap mmx mmxext mng motif mozilla mp3 mpeg msn musepack nas ncurses nls nptl nptlonly nsplugin offensive ogg oggvorbis openal opengl osc oscar oss pam pcntl pcre pdflib perl png ppds pppd python quicktime readline real recode reflection rtc ruby samba sasl sdl session sharedmem shorten skey slp sndfile snmp sockets sox speex spell spl sqlite sse ssl svg sysvipc tcltk tcpd test tetex theora threads tidy tiff truetype truetype-fonts type1-fonts udev unicode usb userlocales v4l vcd videos vorbis wifi win32codecs wmf x264 xanim xface xine xml xml2 xmms xorg xosd xpm xprint xv xvid xvmc yahoo zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, INSTALL_MASK, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_RSYNC_EXTRA_OPTS, PORTAGE_RSYNC_OPTS
Comment 3 Tuan Van (RETIRED) gentoo-dev 2006-08-24 13:25:09 UTC
(In reply to comment #2)
> How can you get a ssp error with vanilla gcc?
> 
> [ebuild   R   ] app-emulation/wine-0.9.8-r1  +X +alsa -arts +cups +debug -esd
> +gif +glut -jack +jpeg +lcms +ldap +nas +ncurses +opengl +oss -scanner
> +truetype +xml
> 
> wine-pthread: stack smashing attack in function WineEngInit()
> Aborted
> 
> gcc-select -l
>  [1] i686-pc-linux-gnu-3.3.6
>  [2] i686-pc-linux-gnu-3.3.6-hardenednopie
>  [3] i686-pc-linux-gnu-3.3.6-hardenednopiessp
>  [4] i686-pc-linux-gnu-3.3.6-hardenednossp
>  [5] i686-pc-linux-gnu-3.3.6-vanilla
>  [6] i686-pc-linux-gnu-3.4.4 *
>  [7] i686-pc-linux-gnu-3.4.4-hardenednopie
>  [8] i686-pc-linux-gnu-3.4.4-hardenednopiessp
>  [9] i686-pc-linux-gnu-3.4.4-hardenednossp
>  [10] i686-pc-linux-gnu-3.4.4-vanilla
>  [11] i686-pc-linux-gnu-4.0.2
> 
it's WFM using hardened profile and gcc-3.4.6-r1. Did you source /etc/profile before re-emerge wine ? BTW, i686-pc-linux-gnu-3.4.4 isn't vanilla for gcc built with USE=hardened. `gcc -v` tells you if vanilla spec is currently in use.

# emerge gcc -vp

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R   ] sys-devel/gcc-3.4.6-r1  USE="hardened nls -bootstrap -boundschecking -build -doc -fortran -gcj -gtk -ip28 -ip32r10k -multilib -multislot -nocxx -nopie -nossp -objc -test -vanilla" 0 kB

# gcc-config -l
 [1] i686-pc-linux-gnu-3.4.6
 [2] i686-pc-linux-gnu-3.4.6-hardenednopie
 [3] i686-pc-linux-gnu-3.4.6-hardenednopiessp
 [4] i686-pc-linux-gnu-3.4.6-hardenednossp
 [5] i686-pc-linux-gnu-3.4.6-vanilla *
# gcc -v
Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.6/specs
Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.6/vanilla.specs
Configured with: /var/tmp/portage/gcc-3.4.6-r1/work/gcc-3.4.6/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.4.6 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.6/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.6 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.6/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.6/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.6/include/g++-v3 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --disable-libunwind-exceptions --disable-multilib --disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 3.4.6 (Gentoo Hardened 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)
www wine # gcc-config 1
 * Switching native-compiler to i686-pc-linux-gnu-3.4.6 ...
>>> Regenerating /etc/ld.so.cache...                                                                                                                           [ ok ]

 * If you intend to use the gcc from the new profile in an already
 * running shell, please remember to do:

 *   # source /etc/profile

# source /etc/profile
# gcc -v
Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.6/specs
Configured with: /var/tmp/portage/gcc-3.4.6-r1/work/gcc-3.4.6/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.4.6 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.6/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.6 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.6/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.6/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.6/include/g++-v3 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --disable-libunwind-exceptions --disable-multilib --disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 3.4.6 (Gentoo Hardened 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)
Comment 4 SpanKY gentoo-dev 2006-08-28 00:01:13 UTC
re-open if 4.1.1 still gives you trouble
Comment 5 Michal Suchanek 2006-08-28 05:47:02 UTC
yes, I compiled wine with gcc4 to get it work. But it does not include ssp, does it?

And it was still unstable last time I looked.
Comment 6 SpanKY gentoo-dev 2006-08-28 10:38:09 UTC
4.1 has ssp
Comment 7 Anders Hellgren gentoo-dev 2006-08-30 07:01:07 UTC
I've finally had the time to debug this, and it (wine-0.9.20 compiled with gcc-3.4.6) works for me if I remove all references to non truetype fonts (e.g. "MS Sans Serif"="sserife.fon") from system.reg.
Comment 8 Michal Suchanek 2007-01-31 10:29:18 UTC
This does not work for me.

I compiled wine 0.9.22 with  gcc 3.4.6, and removed my .wine to make sure the crash is not caused by old configuration.

$ winefile
wine: creating configuration directory '/home/hramrach/.wine'...
lorer.exe: stack smashing attack in function WineEngInit()
exec.exe: stack smashing attack in function WineEngInit()
fixme:ole:ITypeInfo_fnRelease destroy child objects
ll,InstallHinfSection: stack smashing attack in function load_dll()
/usr/bin/../lib/../bin/wineprefixcreate: line 171: 15966 Aborted                 "${WINELOADER:-$bindir/wine}" rundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 128 wine.inf
wine: wineprefixcreate failed while creating '/home/hramrach/.wine'.

Compiling with gcc 4.1.1 would probably work, but it is not a solution.

- it is not a hardened complier - it is masked in the hardened profile

- I suspect it does have ssp but it is not turned on by default. So wine builds but would not work with stack protection anyway.
Comment 9 SpanKY gentoo-dev 2007-02-01 04:10:26 UTC
that sucks but as the bug Resolution indicates, this isnt going to be fixed in gcc-3.4.x

so either build wine without ssp or dont use hardened or do something else
Comment 10 Jakub Moc (RETIRED) gentoo-dev 2007-12-29 15:07:24 UTC
*** Bug 203683 has been marked as a duplicate of this bug. ***