#813948 /usr/bin/vim.gtk: vim-gtk: spins with 100% CPU or segfaults if X11 logs out at E325 prompt

#813948#5
Date:
2016-02-07 00:22:11 UTC
From:
To:
Dear Maintainer,

I've encountered a bug whereby Vim either uses 100% CPU or segfaults.
(The bug is 100% reproducible, but the symptom varies.)  The
reproduction recipe is as follows:

1. Run 'tmux' without arguments.

2. In the resulting shell, run:

    cd $(mktemp -d)
    vim.gtk -Nu NONE -c ':execute "!kill -9" getpid()' foo
    vim.gtk -Nu NONE foo

3. That will give you an E325 prompt.  Do not respond to the prompt; just
log out of X11.

4. At this point, Vim either uses 100% CPU or segfaults.  The gdb
backtraces for both cases are:

    Segfault:
        Program received signal SIGSEGV, Segmentation fault.
        ____longjmp_chk () at ../sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S:130
        130     ../sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S: No such file or directory.
        (gdb) bt
        #0  ____longjmp_chk () at ../sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S:130
        #1  0x8be7340a2f3ebe3e in ?? ()
        Cannot access memory at address 0x8be7340a2f3ebe3e

    Uses 100% CPU:
        (gdb) bt
        #0  0x00007f51091463c9 in __tcgetattr (fd=0, termios_p=termios_p@entry=0x7ffe1726e6c0) at ../sysdeps/unix/sysv/linux/tcgetattr.c:40
        #1  0x00007f5109142bdc in __isatty (fd=<optimized out>) at ../sysdeps/posix/isatty.c:28
        #2  0x00007f510d7f4db0 in no_console_input ()
        #3  0x00007f510d7dd3bc in ui_inchar ()
        #4  0x00007f510d6ec81f in inchar ()
        #5  0x00007f510d6ee8ce in ?? ()
        #6  0x00007f510d6ef093 in vgetc ()
        #7  0x00007f510d6ef4f9 in safe_vgetc ()
        #8  0x00007f510d711b76 in wait_return ()
        #9  0x00007f510d821dd8 in getout ()
        #10 0x00007f510bf0768f in _SmcProcessMessage () from /usr/lib/x86_64-linux-gnu/libSM.so.6
        #11 0x00007f510bcf733c in IceProcessMessages () from /usr/lib/x86_64-linux-gnu/libICE.so.6
        #12 0x00007f510d75da8d in xsmp_handle_requests ()
        #13 0x00007f510d75e0d3 in ?? ()
        #14 0x00007f510d75e293 in ?? ()
        #15 0x00007f510d75e51b in mch_inchar ()
        #16 0x00007f510d7dd418 in ui_inchar ()
        #17 0x00007f510d7171ac in get_keystroke ()
        #18 0x00007f510d7113ab in do_dialog ()
        #19 0x00007f510d707964 in ?? ()
        #20 0x00007f510d707ac2 in ml_open_file ()
        #21 0x00007f510d6dd36f in readfile ()
        #22 0x00007f510d66aa4c in open_buffer ()
        #23 0x00007f510d662b75 in main ()

Cheers,

Daniel

P.S. I haven't been able confirm whether or not the bug is present in
unstable, despite trying in a VM and asking on IRC, so I'm reporting the
bug against stable, which is what I'm running.  Apologies if the bug has
already been fixed in a newer version.
--- real paths of main Vim binaries ---
/usr/bin/vi is /usr/bin/vim.gtk
/usr/bin/vim is /usr/bin/vim.gtk
/usr/bin/gvim is /usr/bin/vim.gtk