Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 57378 - vim segfaults for no reason
Summary: vim segfaults for no reason
Status: RESOLVED CANTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Vim Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-17 04:46 UTC by Alex
Modified: 2004-07-25 10:30 UTC (History)
1 user (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 Alex 2004-07-17 04:46:37 UTC
ever since I upgraded to 2.6.8-r1 vim 6.3 segfaults when you attempt to launch it on the command line, although gvim and kvim work just fine.

Reproducible: Always
Steps to Reproduce:
1. emerge vim 6.3
2. upgrade to kernel 2.6.8-r1
3. run vim

Actual Results:  
vim segfaults

Expected Results:  
vim should open from the command line and present me with the usual interface.

joseph-a-nagy-jr root # gdb vim
GNU gdb 6.1.1
Copyright 2004 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 "i686-pc-linux-gnu"...Using host libthread_db library
"/lib/libthread_db.so.1".

(gdb) run
Starting program: /usr/bin/vim 
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.

Program received signal SIGSEGV, Segmentation fault.
0x080c6749 in gettail ()

joseph-a-nagy-jr root # emerge info
Portage 2.0.50-r9 (default-x86-2004.0, gcc-3.3.4, glibc-2.3.4.20040619-r0,
2.6.8-rc1)
=================================================================
System uname: 2.6.8-rc1 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz
Gentoo Base System version 1.5.1
Autoconf: sys-devel/autoconf-2.59-r4
Automake: sys-devel/automake-1.8.5-r1
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-Os -march=pentium3 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3.2/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref
/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/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-Os -march=pentium3 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs buildpkg ccache digest nostrip sandbox userpriv usersandbox"
GENTOO_MIRRORS="ftp:///ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/
http://128.213.5.34/gentoo/ http://mirror.datapipe.net/gentoo
ftp://mirrors.sec.informatik.tu-darmstadt.de/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X aalib acl acpi aim alsa apache2 apm arts audiofile avi berkdb bidi bonobo
canna caps cdr cjk crypt cscope cups curl debug directfb divx4linux doc dvd
encode esd evo f77 fbcon fftw flac flash foomaticdb freetds freewnn gb gcj gd
gdbm gif gimp gimpprint gnome gpm gtk gtk2 gtkhtml icq imagemagick imap imlib
innodb ipv6 jabber jack java joystick jpeg kde lcms ldap libg++ libwww mad
maildir mailwrapper mbox mikmod mmx mng motif mozilla mpeg msn mysql nas ncurses
nls objc odbc offensive oggvorbis opengl oscar oss pam pdflib perl pic png
postgres python qt quickline quicktime readline realplayer samba sasl scanner
sdl slang slp snmp spell sse ssl svg svga tcltk tcpd tetex theora tiff truetype
unicode usb vhosts videos x86 xml xml2 xmms xv xvid yahoo zlib"
Comment 1 Ciaran McCreesh 2004-07-17 09:53:48 UTC
Finally, someone submits a bug report for this :) A few questions... What headers are you running? Can you rebuild without the -fomit-frame-pointer and with -g to get a better gdb stacktrace?
Comment 2 Alex 2004-07-17 10:08:06 UTC
*  sys-kernel/linux-headers
      Latest version available: 2.4.22
      Latest version installed: 2.4.22
      Size of downloaded files: [no/bad digest]
      Homepage:    http://www.kernel.org/ http://www.gentoo.org/
      Description: Linux 2.4.22 headers from kernel.org

I imagine I should update my linux headers (doing so now).

updated traceback:

GNU gdb 6.1.1
Copyright 2004 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 "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) run
Starting program: /usr/bin/vim 
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.

Program received signal SIGSEGV, Segmentation fault.
gettail (fname=0x3 <Address 0x3 out of bounds>) at misc1.c:4027
4027    misc1.c: No such file or directory.
        in misc1.

fixing headers now
Comment 3 Alex 2004-07-17 11:28:28 UTC
Rebooted into kernel 2.6.8-rc1 compiled with the 2.6.6 headers, vim still segfaults and returns the following gdb output:

joseph-a-nagy-jr root # gdb vim
GNU gdb 6.1.1
Copyright 2004 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 "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) run
Starting program: /usr/bin/vim 
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.

Program received signal SIGSEGV, Segmentation fault.
gettail (fname=0x3 <Address 0x3 out of bounds>) at misc1.c:4027
4027    misc1.c: No such file or directory.
        in misc1.c
Comment 4 Brandon Hale (RETIRED) gentoo-dev 2004-07-17 13:52:15 UTC
FEATURES="nostrip noclean" CFLAGS="-g -O2 -march=pentium4" semerge vim

(gdb) run 
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /usr/bin/vim stack
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.

Program received signal SIGSEGV, Segmentation fault.
gettail (fname=0x3 <Address 0x3 out of bounds>) at misc1.c:4027
4027    in misc1.c

(gdb) backtrace
#0  gettail (fname=0x3 <Address 0x3 out of bounds>) at misc1.c:4027
#1  0x080c1351 in main (argc=2, argv=0xbffff1c0) at main.c:484

Relevant bits from emerge info:
Portage 2.0.51_pre13 (default-x86-2004.0, gcc-3.3.4, glibc-2.3.4.20040619-r0, 2.6.8-rc1 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz)
=================================================================
System uname: 2.6.8-rc1 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz
Gentoo Base System version 1.5.1
ccache version 2.3 [enabled]
Autoconf: sys-devel/autoconf-2.59-r4
Automake: sys-devel/automake-1.8.5-r1
Binutils: sys-devel/binutils-2.14.90.0.8-r1
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -march=pentium4 -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
<snip>
MAKEOPTS="-j2"
<snip>
USE="X alsa apm avi berkdb cdr cdrw crypt cups dvd encode flac foomaticdb gdbm gif gnome gpm gtk gtk2 imlib jpeg libg++ libwww mad mikmod motif mozilla mpeg ncurses oggvorbis opengl oss pam pdflib perl png python quicktime readline sdl slang spell ssl svga tcpd truetype x86 xine xml2 xv zlib"



Comment 5 Brandon Hale (RETIRED) gentoo-dev 2004-07-17 13:57:54 UTC
Other relevant bits:
Less -march=pentium4, I get a working vim.
Gvim with the full set of cflags works as expected.
linux-headers are 2.6.5
Comment 6 Ciaran McCreesh 2004-07-17 13:58:43 UTC
So, we have gettail being called with a duff pointer. The caller is:

    initstr = gettail((char_u *)argv[0]);

so argv[0] is broken? Surely not...

Alex -- if you remove the -march from your CFLAGS, does it go away?
Comment 7 Brandon Hale (RETIRED) gentoo-dev 2004-07-17 14:22:35 UTC
Here's another gdb session Ciaran and I attempted.

GNU gdb 6.1
Copyright 2004 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 "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) break main.c:407
Breakpoint 1 at 0x80c1224: file main.c, line 407.
(gdb) run
Starting program: /usr/bin/vim 
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.

Breakpoint 1, main (argc=1, argv=0xbffff1bc) at main.c:408
(gdb) run
Starting program: /usr/bin/vim 
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.

Breakpoint 1, main (argc=1, argv=0xbffff1bc) at main.c:408
408     main.c: No such file or directory.
        in main.c
(gdb) print argv[0]
$1 = 0x8097e36 "\211]U\211WVS\203\034E|\035\bE\006"
(gdb) 
Comment 8 Brandon Hale (RETIRED) gentoo-dev 2004-07-17 14:27:26 UTC
(gdb) break main
Breakpoint 1 at 0x80c10c8: file main.c, line 137.
(gdb) run
Starting program: /usr/bin/vim 
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.

Breakpoint 1, main (argc=1, argv=0x40275088) at main.c:137
137     main.c: No such file or directory.
        in main.c
(gdb) watch argv
Watchpoint 2: argv
(gdb) watch argv[0]
Watchpoint 3: argv[0]
(gdb) continue
Continuing.
Watchpoint 2: argv

Old value = (char **) 0x40275088
New value = (char **) 0xbffff334
Watchpoint 3: argv[0]

Old value = 0x108f3c <Address 0x108f3c out of bounds>
New value = 0xbffff4d7 "/usr/bin/vim"
main (argc=1, argv=0xbffff334) at main.c:95
95      in main.c
Comment 9 Brandon Hale (RETIRED) gentoo-dev 2004-07-17 14:33:42 UTC
Continuing for a bit more to try and hit the segfault:

Old value = (char **) 0x401c9e05
New value = (char **) 0x40275088
0x401c9e0b in _IO_str_pbackfail () from /lib/libc.so.6
(gdb) continue
Continuing.
Error evaluating expression for watchpoint 2
Previous frame identical to this frame (corrupt stack?)
Watchpoint 2 deleted.
0x402176dc in getpagesize () from /lib/libc.so.6
(gdb) continue
Continuing.

Program received signal SIGSEGV, Segmentation fault.
gettail (fname=0x3 <Address 0x3 out of bounds>) at misc1.c:4027
4027    misc1.c: No such file or directory.
        in misc1.c
Comment 10 Brandon Hale (RETIRED) gentoo-dev 2004-07-17 14:37:17 UTC
(gdb) continue
Continuing.
Watchpoint 2: argv

Old value = (char **) 0x401c9e05
New value = (char **) 0x40275088
0x401c9e0b in _IO_str_pbackfail () from /lib/libc.so.6
(gdb) backtrace 
#0  0x401c9e0b in _IO_str_pbackfail () from /lib/libc.so.6
#1  0x401ca260 in __libc_malloc_pthread_startup () from /lib/libc.so.6
#2  0x401ca8dc in __libc_malloc_pthread_startup () from /lib/libc.so.6
#3  0x401cbf43 in malloc () from /lib/libc.so.6
#4  0x081041b9 in mch_early_init () at os_unix.c:2629
#5  0x080c118e in main (argc=1, argv=0x40275088) at main.c:162
(gdb) continue
Continuing.
Error evaluating expression for watchpoint 2
Previous frame identical to this frame (corrupt stack?)
Watchpoint 2 deleted.
0x402176dc in getpagesize () from /lib/libc.so.6
(gdb) backtrace
#0  0x402176dc in getpagesize () from /lib/libc.so.6
#1  0xbffff150 in ?? ()
#2  0x401c9e38 in _IO_str_pbackfail () from /lib/libc.so.6
Comment 11 Ciaran McCreesh 2004-07-17 15:25:01 UTC
So, something outside of vim is overwriting *argv. Ouch.
Comment 12 Alex 2004-07-17 16:06:56 UTC
In reply to comment #6:

Trying that now.

In reply to comment #11:

Ouch indeed.

I have recompiled vim-core and vim and it still segfaults:

(gdb) run
Starting program: /usr/bin/vim 
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.

Program received signal SIGSEGV, Segmentation fault.
gettail (fname=0x3 <Address 0x3 out of bounds>) at misc1.c:4027
4027    misc1.c: No such file or directory.
        in misc1.c
(gdb) continue
Continuing.

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
(gdb) backtrace
No stack.
Comment 13 Brandon Hale (RETIRED) gentoo-dev 2004-07-17 19:12:43 UTC
Kids, dont try debugging when you are stripping away the
debug symbols. It doesnt work. (Hint, build it like me).
Comment 14 Alex 2004-07-17 19:28:27 UTC
I've told it /not/ to strip the debug symbols, yet it does anyways. )':

Portage 2.0.50-r9 (default-x86-2004.0, gcc-3.3.4, glibc-2.3.4.20040619-r0, 2.6.8-rc1)
=================================================================
System uname: 2.6.8-rc1 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz
Gentoo Base System version 1.5.1
Autoconf: sys-devel/autoconf-2.59-r4
Automake: sys-devel/automake-1.8.5-r1
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-Os -pipe -g"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.2/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /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/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-Os -pipe -g"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs buildpkg ccache digest nostrip sandbox userpriv usersandbox"
GENTOO_MIRRORS="ftp:///ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ http://128.213.5.34/gentoo/ http://mirror.datapipe.net/gentoo ftp://mirrors.sec.informatik.tu-darmstadt.de/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"  
PORTAGE_TMPDIR="/tmp"           
PORTDIR="/usr/portage"          
PORTDIR_OVERLAY=""              
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X aalib acl acpi aim alsa apache2 apm arts audiofile avi berkdb bidi bonobo canna caps cdr cjk crypt cscope cups curl debug directfb divx4linux doc dvd encode esd evo f77 fbcon fftw flac flash foomaticdb freetds freewnn gb gcj gd gdbm gif gimp gimpprint gnome gpm gtk gtk2 gtkhtml icq imagemagick imap imlib innodb ipv6 jabber jack java joystick jpeg kde lcms ldap libg++ libwww mad maildir mailwrapper mbox mikmod mmx mng motif mozilla mpeg msn mysql nas ncurses nls objc odbc offensive oggvorbis opengl oscar oss pam pdflib perl pic png postgres python qt quickline quicktime readline realplayer samba sasl scanner sdl slang slp snmp spell sse ssl svg svga tcltk tcpd tetex theora tiff truetype unicode usb vhosts videos x86 xml xml2 xmms xv xvid yahoo zlib"

debug is even in my use flags!

notice the "nostrip" in my FEATURES as well.
Comment 15 K. Posern 2004-07-23 01:10:14 UTC
Hi.

I have the same problem! But for me it was first not clear if it was the updated system or the kernel or a change I did at my useflags...

BUT now I am quiet sure that it is the kernel, because: I updated and recompiled my complete system from scratch (emerge -e world). Everything (I used so far;-) works fine. gvim works. But vim gives a segmentation fault.

I don't now much about debugging... I tried once a strace... ;-)

I now tried gdb and it also says: SIGSEGV in gettail() for me.

The problem occured after updating from:
       2.6.5-rc3-mm4
       to
       2.6.7-mm1 and stayed with 2.6.7-mm4 and 2.6.7-mm6 until today...

So if I reboot with the 2.6.5er Kernel it WORKS!

But with the other kernels it doesn't.

Maybe this helps... cause I begin to really miss my little neat VIM... ;-)

Ah by the way: I only have installed "linux-headers" so nothing with "linux26-headers" (<<< do I need them?... I have them with my kernel-sources, or???)


Greetings,

tormen.

_____

emerge info:

Portage 2.0.50-r9 (default-x86-2004.0, gcc-3.3.3, glibc-2.3.3.20040420-r0, 2.6.7-mm6)
=================================================================
System uname: 2.6.7-mm6 i686 Intel(R) Pentium(R) 4 CPU 2.53GHz
Gentoo Base System version 1.4.16
Autoconf: sys-devel/autoconf-2.59-r3
Automake: sys-devel/automake-1.8.3
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-march=pentium4 -pipe -fomit-frame-pointer -O3"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.2/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /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/gconf /etc/init.d /etc/terminfo /etc/env.d"
CXXFLAGS="-march=pentium4 -pipe -fomit-frame-pointer -O3"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox sfperms strict userpriv usersandbox"
GENTOO_MIRRORS=" 
     http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/      ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo 
     http://212.219.247.11/sites/www.ibiblio.org/gentoo/ 
     http://212.219.247.12/sites/www.ibiblio.org/gentoo/ 
"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X aac aalib acl acpi acpi4linux aim alsa amd apache2 apm arts audiofile avi berkdb bonobo cdr crypt cups dga directfb divx4linux dv dvd dvdr emacs emacs-w3 encode esd ethereal faac faad fam fax fbcon ffmpeg firebird flac foomaticdb gb gdbm geoip ggi gif gimp gimpprint gnome gphoto2 gpm gstreamer gtk gtk2 gtkhtml guile hbci icq imagemagick imap imlib ipv6 jabber jack java jce jikes jp2 jpeg kde kerberos ladcca lcms libcaca libg++ libsamplerate libwww lirc live mad maildir matroska matrox memlimit mikmod mldonkeypango mmx motif mozdomi mozilla mozxmlterm mpeg mpeg4 mplayer msn mysql nas ncurses nls ntlm odbc ofx oggvorbis opengl oscar oss pam pcap pcre pdflib perl php png posix postgres ppds pthreads python qt quicktime readline ruby samba scanner sdl silc slang speex spell spl sqlite sse ssl svga tcltk tcpd tetex theora tiff transcode truetype unicode usb v4l v4l2 videos wmf x86 xemacs xml xml2 xmms xosd xprint xv xvid yahoo yv12 zlib zvbi"
Comment 16 Ciaran McCreesh 2004-07-23 11:24:04 UTC
Hm, have any of you tried 2.6.8rc2?
Comment 17 Brandon Hale (RETIRED) gentoo-dev 2004-07-25 08:54:03 UTC
Problem is gone on 2.6.8-rc2 and -march=pentium4 restored
Comment 18 Ciaran McCreesh 2004-07-25 10:30:08 UTC
Ok, looks like this is a kernel bug (seems to be the same one giving people problems with Java), so closing this as CANTFIX. The workaround is to use <2.6.7 or >=2.6.8_rc2.