Subject: Re: bug#20431: emacs-24.5 segfaults with gnutls-3.4.0

From: Fernando de Oliveira <[email-masked]>
Date: Tue, 05 May 2015 09:39:33 -0300

Sorry, forgt to send to the bug report

On 04-05-2015 19:13, Ted Zlatanov wrote:
> On Sun, 26 Apr 2015 14:23:46 -0300 Fernando de Oliveira <[email-masked]> wrote: 
> 
> FdO> I am having this segfault problem and could not solve by myself.
> ...
> FdO> Build log tail with the error (I1ve replaced "Falha de segmentação" by
> FdO> "Segmentation fault":
> ...
> 
> Hi Fernando,
> 
> I don't know if the problem is in the GnuTLS integration from this stack
> trace, but I'm definitely not seeing it here. Is it still happening for
> you? Can you replicate it with the released 24.4? How about the latest
> (Git master branch)?

Hi Ted,

Thanks for your post.

System updated to gnutls-3.4.1.

FWIW:
gcc (GCC) 5.1.0 (but my first post was with gcc-4.9.2)
clang version 3.6.0 (tags/RELEASE_360/final)

Tested versions: 24.4, 24.5 (again), Git emacs-24 branch (24.5.50), and
Git master branch (25.0.50, also tried to use clang, for this one).

Unfortunately, still same issue:

{{{
$ cd emacs-25.0.50/src
$ gdb temacs
...
(gdb) set args --batch --load loadup bootstrap
(gdb) run
...

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff0ce8f24 in free () from /lib/libc.so.6
(gdb) bt
#0  0x00007ffff0ce8f24 in free () from /lib/libc.so.6
#1  0x00007ffff16a97ab in _gnutls_ext_deinit () at gnutls_extensions.c:399
#2  0x00007ffff16b0860 in _gnutls_global_deinit (destructor=1)
    at gnutls_global.c:385
#3  0x00007ffff7dea727 in _dl_fini () from /lib64/ld-linux-x86-64.so.2
#4  0x00007ffff0ca3d92 in __run_exit_handlers () from /lib/libc.so.6
#5  0x00007ffff0ca3de5 in exit () from /lib/libc.so.6
#6  0x00000000004ea4ff in Fkill_emacs (arg=<optimized out>) at emacs.c:1952
#7  0x0000000000559541 in eval_sub (form=<optimized out>) at eval.c:2181
#8  0x00000000005597fd in Fprogn (body=18685187) at eval.c:445
#9  0x0000000000559471 in eval_sub (form=<optimized out>) at eval.c:2131
#10 0x0000000000559471 in eval_sub (form=form@entry=12492531) at eval.c:2131
#11 0x000000000057b8d8 in readevalloop
(readcharfun=readcharfun@entry=25536,
    stream=stream@entry=0xc2e040, sourcename=sourcename@entry=12769012,
    printflag=printflag@entry=false, unibyte=unibyte@entry=0,
    readfun=readfun@entry=0, start=0, end=0) at lread.c:1929
#12 0x000000000057bf6c in Fload (file=12768756, noerror=<optimized out>,
    nomessage=0, nosuffix=<optimized out>, must_suffix=<optimized out>)
    at lread.c:1326
#13 0x00000000005594e5 in eval_sub (form=form@entry=12698259) at eval.c:2195
#14 0x000000000055c831 in Feval (form=12698259, lexical=<optimized out>)
    at eval.c:1996
#15 0x0000000000558667 in internal_condition_case (
---Type <return> to continue, or q <return> to quit---
    bfun=bfun@entry=0x4eaa00 <top_level_2>, handlers=handlers@entry=19824,
    hfun=hfun@entry=0x4ef360 <cmd_error>) at eval.c:1348
#16 0x00000000004ed33c in top_level_1 (ignore=ignore@entry=0)
    at keyboard.c:1156
#17 0x0000000000558543 in internal_catch (tag=tag@entry=46992,
    func=func@entry=0x4ed2e0 <top_level_1>, arg=arg@entry=0) at eval.c:1108
#18 0x00000000004ea998 in command_loop () at keyboard.c:1117
#19 0x00000000004eef4b in recursive_edit_1 () at keyboard.c:728
#20 0x00000000004ef298 in Frecursive_edit () at keyboard.c:799
#21 0x0000000000419df7 in main (argc=5, argv=0x7fffffffdeb8) at emacs.c:1626
(gdb)
}}}

Adding possibly relevant info:

{{{
Configured for 'x86_64-unknown-linux-gnu'.

  Where should the build process find the source code?    .
  What compiler should emacs be built with?               gcc -g3 -O2
  Should Emacs use the GNU version of malloc?             yes
      (Using Doug Lea's new malloc from the GNU C Library.)
  Should Emacs use a relocating allocator for buffers?    no
  Should Emacs use mmap(2) for buffer allocation?         no
  What window system should Emacs use?                    x11
  What toolkit should Emacs use?                          GTK3
  Where do we find X Windows header files?                Standard dirs
  Where do we find X Windows libraries?                   Standard dirs
  Does Emacs use -lXaw3d?                                 no
  Does Emacs use -lXpm?                                   yes
  Does Emacs use -ljpeg?                                  yes
  Does Emacs use -ltiff?                                  yes
  Does Emacs use a gif library?                           yes -lgif
  Does Emacs use a png library?                           yes -lpng16
  Does Emacs use -lrsvg-2?                                yes
  Does Emacs use imagemagick?                             yes
  Does Emacs support sound?                               yes
  Does Emacs use -lgpm?                                   yes
  Does Emacs use -ldbus?                                  yes
  Does Emacs use -lgconf?                                 yes
  Does Emacs use GSettings?                               yes
  Does Emacs use a file notification library?             yes -lgio (gfile)
  Does Emacs use access control lists?                    yes -lacl
  Does Emacs use -lselinux?                               no
  Does Emacs use -lgnutls?                                yes
  Does Emacs use -lxml2?                                  yes
  Does Emacs use -lfreetype?                              yes
  Does Emacs use -lm17n-flt?                              no
  Does Emacs use -lotf?                                   no
  Does Emacs use -lxft?                                   yes
  Does Emacs directly use zlib?                           yes
  Does Emacs use toolkit scroll bars?                     yes
}}}

Thanks again,

-- 
[]s,
Fernando