Subject: Commit b88e9cded7ae3756e3a2ec4a23e8df352a0239f9 breaks emacs dumping for me

From: Elric Milon <[email-masked]>
Date: Mon, 01 Feb 2016 14:37:21 +0100

Trying to build current master failed while dumping emacs, so I ran a
git bisect with the following script to find the culprit:

8<------------8<------------8<------------8<------------8<------------
set -ex

./autogen.sh

./configure --prefix $(readlink -fe $PWD/../inst) \
    --enable-link-time-optimization \
    --without-pop \
    --with-x-toolkit=gtk3 \
    --without-xaw3d \
    --without-selinux \
    --with-file-notification=yes \
    --with-modules \
    --with-cairo \
    --without-pop \
    --with-x

make -j$(grep processor /proc/cpuinfo |wc -l ) bootstrap
make -j$(grep processor /proc/cpuinfo |wc -l )

make install

8<------------8<------------8<------------8<------------8<------------

And this is the failure message:

8<------------8<------------8<------------8<------------8<------------

[...]
Loading /var/data/src/emacs/emacs/lisp/tooltip.el (source)...
Finding pointers to doc strings...
Finding pointers to doc strings...done
Dumping under the name emacs
92361 pure bytes used
: paxctl -zex emacs
mv -f emacs bootstrap-emacs
make -C ../lisp compile-first EMACS="../src/bootstrap-emacs"
make[3]: Entering directory '/var/data/src/emacs/emacs/lisp'
  ELC      emacs-lisp/byte-opt.elc
  ELC      emacs-lisp/autoload.elc
  ELC      emacs-lisp/cconv.elc
  ELC      emacs-lisp/macroexp.elc
  ELC      emacs-lisp/bytecomp.elc
*** Error in `../src/bootstrap-emacs': corrupted double-linked list: 0x0000000001b7c860 ***

Backtrace:
../src/bootstrap-emacs[0x4da592]
../src/bootstrap-emacs[0x511f79]
../src/bootstrap-emacs[0x4cfb9e]
../src/bootstrap-emacs[0x498263]
/lib/x86_64-linux-gnu/libpthread.so.0[0x3dae810660]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37)[0x3dae033507]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x3dae0348da]
/lib/x86_64-linux-gnu/libc.so.6[0x3dae071a63]
/lib/x86_64-linux-gnu/libc.so.6[0x3dae076ebe]
/lib/x86_64-linux-gnu/libc.so.6[0x3dae079f62]
/lib/x86_64-linux-gnu/libc.so.6(realloc+0xf0)[0x3dae07b0e0]
../src/bootstrap-emacs[0x4ab8c2]
../src/bootstrap-emacs[0x4b33b7]
../src/bootstrap-emacs[0x566b92]
../src/bootstrap-emacs[0x47eb4b]
../src/bootstrap-emacs[0x48b4f6]
../src/bootstrap-emacs[0x470f23]
../src/bootstrap-emacs[0x47b3dd]
../src/bootstrap-emacs[0x470ebe]
../src/bootstrap-emacs[0x47b12d]
../src/bootstrap-emacs[0x470ebe]
../src/bootstrap-emacs[0x47b3dd]
../src/bootstrap-emacs[0x470ebe]
../src/bootstrap-emacs[0x47bbbd]
../src/bootstrap-emacs[0x470ebe]
../src/bootstrap-emacs[0x47149d]
../src/bootstrap-emacs[0x479298]
../src/bootstrap-emacs[0x470cdf]
../src/bootstrap-emacs[0x4793b1]
../src/bootstrap-emacs[0x4707a2]
../src/bootstrap-emacs[0x507e24]
../src/bootstrap-emacs[0x47084b]
../src/bootstrap-emacs[0x511c48]
../src/bootstrap-emacs[0x511cdb]
../src/bootstrap-emacs[0x511e08]
../src/bootstrap-emacs[0x41941f]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x3dae020870]
../src/bootstrap-emacs[0x41b6a9]
*** Error in `../src/bootstrap-emacs': corrupted double-linked list: 0x0000000001b7c860 ***
Fatal error 6: Aborted
Backtrace:
../src/bootstrap-emacs[0x4da592]
*** Error in `../src/bootstrap-emacs[0x511f79]
../src/bootstrap-emacs[0x4cfb9e]
../src/bootstrap-emacs[0x498263]
/lib/x86_64-linux-gnu/libpthread.so.0[0x3dae810660]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37)[0x3dae033507]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x
Backtrace:
16a../src/bootstrap-emacs)[0x[0x4da592]
../src/bootstrap-emacs3dae0348da]
[0x511f79]
../src/bootstrap-emacs[0x4cfb9e]
../src/bootstrap-emacs[0x/lib/x86_64-linux-gnu/libc.so.6498263]
[0x3dae071a63]
/lib/x86_64-linux-gnu/libpthread.so.0[0x3dae810660]
/lib/x86_64-linux-gnu/libc.so.6[0x3dae076ebe]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37)[0x3dae033507]
/lib/x86_64-linux-gnu/libc.so.6[0x3dae079f62]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x3dae0348da/lib/x86_64-linux-gnu/libc.so.6]
(realloc+0xf0)[0x3dae07b0e0]
../src/bootstrap-emacs[0x4ab8c2/lib/x86_64-linux-gnu/libc.so.6[0x]
../src/bootstrap-emacs3dae071a63]
[0x4b33b7]
../src/bootstrap-emacs[0x566b92]
../src/bootstrap-emacs[0x/lib/x86_64-linux-gnu/libc.so.647eb4b]
[0x../src/bootstrap-emacs[0x48b4f63dae076ebe]
]
../src/bootstrap-emacs[0x470f23]
../src/bootstrap-emacs[0x47b3dd]
/lib/x86_64-linux-gnu/libc.so.6[0x3dae079f62../src/bootstrap-emacs[0x]
470ebe]
../src/bootstrap-emacs[0x47b12d]
../src/bootstrap-emacs[0x470ebe]
../src/bootstrap-emacs/lib/x86_64-linux-gnu/libc.so.6[0x47b3dd]
../src/bootstrap-emacs(realloc+0xf0[0x470ebe]
../src/bootstrap-emacs)[0x[0x47bbbd]
../src/bootstrap-emacs3dae07b0e0]
[0x../src/bootstrap-emacs[0x470ebe]
../src/bootstrap-emacs4ab8c2]
../src/bootstrap-emacs[0x47149d]
../src/bootstrap-emacs[0x[0x479298]
../src/bootstrap-emacs4b33b7]
[0x470cdf]
../src/bootstrap-emacs../src/bootstrap-emacs[0x[0x566b92]
4793b1]
../src/bootstrap-emacs../src/bootstrap-emacs[0x47eb4b[0x4707a2]
]
../src/bootstrap-emacs[0x507e24../src/bootstrap-emacs]
../src/bootstrap-emacs[0x48b4f6]
[0x../src/bootstrap-emacs[0x47084b]
470f23../src/bootstrap-emacs[0x511c48]
../src/bootstrap-emacs[0x47b3dd]
]
../src/bootstrap-emacs../src/bootstrap-emacs[0x470ebe]
../src/bootstrap-emacs[0x511cdb[0x47b12d]
]
../src/bootstrap-emacs../src/bootstrap-emacs[0x[0x470ebe]
511e08]
../src/bootstrap-emacs../src/bootstrap-emacs[0x[0x41941f]
47b3dd]
../src/bootstrap-emacs[0x470ebe]
../src/bootstrap-emacs/lib/x86_64-linux-gnu/libc.so.6([0x47bbbd]
../src/bootstrap-emacs__libc_start_main+0xf0[0x470ebe)[0x3dae020870]
../src/bootstrap-emacs]
[0x../src/bootstrap-emacs[0x47149d]
../src/bootstrap-emacs41b6a9]
[0x479298]
../src/bootstrap-emacs[0x470cdf]
../src/bootstrap-emacs[0x4793b1]
../src/bootstrap-emacs[0x4707a2]
../src/bootstrap-emacs[0x507e24]
../src/bootstrap-emacs[0x47084b]
../src/bootstrap-emacs[0x511c48]
../src/bootstrap-emacs[0x511cdb]
../src/bootstrap-emacs[0x511e08]
../src/bootstrap-emacs[0x41941f]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x3dae020870]
../src/bootstrap-emacs[0x41b6a9]
/bin/bash: line 1: 10631 Aborted                 EMACSLOADPATH= '../src/bootstrap-emacs' -batch --no-site-file --no-site-lisp --eval "(setq max-lisp-eval-depth 2200)" --eval '(setq load-prefer-newer t)' -f batch-byte-compile emacs-lisp/autoload.el
Makefile:268: recipe for target 'emacs-lisp/autoload.elc' failed
make[3]: *** [emacs-lisp/autoload.elc] Error 134
make[3]: *** Waiting for unfinished jobs....
/bin/bash: line 1: 10633 Aborted                 EMACSLOADPATH= '../src/bootstrap-emacs' -batch --no-site-file --no-site-lisp --eval "(setq max-lisp-eval-depth 2200)" --eval '(setq load-prefer-newer t)' -f batch-byte-compile emacs-lisp/macroexp.el
Makefile:268: recipe for target 'emacs-lisp/macroexp.elc' failed
make[3]: *** [emacs-lisp/macroexp.elc] Error 134
/bin/bash: line 1: 10632 Aborted                 EMACSLOADPATH= '../src/bootstrap-emacs' -batch --no-site-file --no-site-lisp --eval "(setq max-lisp-eval-depth 2200)" --eval '(setq load-prefer-newer t)' -f batch-byte-compile emacs-lisp/cconv.el
Makefile:268: recipe for target 'emacs-lisp/cconv.elc' failed
make[3]: *** [emacs-lisp/cconv.elc] Error 134
*** Error in `../src/bootstrap-emacs': corrupted double-linked list: 0x0000000001b7c860 ***

Backtrace:

Backtrace:
../src/bootstrap-emacs[0x4da592]
../src/bootstrap-emacs[0x4da592../src/bootstrap-emacs]
[0x../src/bootstrap-emacs511f79]
../src/bootstrap-emacs[0x511f79[0x4cfb9e]
]
../src/bootstrap-emacs[0x498263]
../src/bootstrap-emacs/lib/x86_64-linux-gnu/libpthread.so.0[0x4cfb9e[0x3dae810660]
]
../src/bootstrap-emacs[0x498263]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37)[0x/lib/x86_64-linux-gnu/libpthread.so.03dae033507]
[0x3dae810660]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x3dae0348da]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37)[0x3dae033507]
/lib/x86_64-linux-gnu/libc.so.6[0x3dae071a63]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x/lib/x86_64-linux-gnu/libc.so.6[0x16a)3dae076ebe]
[0x3dae0348da]
/lib/x86_64-linux-gnu/libc.so.6[0x3dae079f62]
/lib/x86_64-linux-gnu/libc.so.6[0x3dae071a63]
/lib/x86_64-linux-gnu/libc.so.6(realloc+0xf0)[0x3dae07b0e0]
../src/bootstrap-emacs[0x4ab8c2]
../src/bootstrap-emacs[0x/lib/x86_64-linux-gnu/libc.so.64b33b7]
../src/bootstrap-emacs[0x3dae076ebe[0x566b92]
../src/bootstrap-emacs]
[0x47eb4b]
../src/bootstrap-emacs[0x48b4f6]
../src/bootstrap-emacs[0x470f23]
../src/bootstrap-emacs[0x47b3dd]
/lib/x86_64-linux-gnu/libc.so.6../src/bootstrap-emacs[0x470ebe]
[0x../src/bootstrap-emacs[0x47b12d]
../src/bootstrap-emacs3dae079f62]
[0x470ebe]
../src/bootstrap-emacs[0x47b3dd]
../src/bootstrap-emacs[0x470ebe]
../src/bootstrap-emacs[0x47bbbd]
../src/bootstrap-emacs[0x470ebe/lib/x86_64-linux-gnu/libc.so.6(]
../src/bootstrap-emacsrealloc[0x47149d]
../src/bootstrap-emacs+0xf0[0x479298]
)../src/bootstrap-emacs[0x470cdf]
[0x../src/bootstrap-emacs[0x4793b1]
3dae07b0e0../src/bootstrap-emacs[0x4707a2]
../src/bootstrap-emacs]
[0x../src/bootstrap-emacs507e24]
../src/bootstrap-emacs[0x4ab8c2[0x47084b]
../src/bootstrap-emacs]
[0x../src/bootstrap-emacs[0x511c48]
../src/bootstrap-emacs4b33b7]
[0x../src/bootstrap-emacs511cdb]
../src/bootstrap-emacs[0x566b92[0x511e08]
../src/bootstrap-emacs]
[0x../src/bootstrap-emacs[0x41941f]
47eb4b]
../src/bootstrap-emacs[0x48b4f6/lib/x86_64-linux-gnu/libc.so.6]
(../src/bootstrap-emacs[0x__libc_start_main+0xf0)[0x470f23]
3dae020870../src/bootstrap-emacs]
../src/bootstrap-emacs[0x47b3dd[0x41b6a9]
]
../src/bootstrap-emacs[0x470ebe]
../src/bootstrap-emacs[0x47b12d]
../src/bootstrap-emacs[0x470ebe]
../src/bootstrap-emacs[0x47b3dd]
../src/bootstrap-emacs[0x470ebe]
../src/bootstrap-emacs[0x47bbbd]
../src/bootstrap-emacs[0x470ebe]
../src/bootstrap-emacs[0x47149d]
../src/bootstrap-emacs[0x479298]
../src/bootstrap-emacs[0x470cdf]
../src/bootstrap-emacs[0x4793b1]
../src/bootstrap-emacs[0x4707a2]
../src/bootstrap-emacs[0x507e24]
../src/bootstrap-emacs[0x47084b]
../src/bootstrap-emacs[0x511c48]
../src/bootstrap-emacs[0x511cdb]
../src/bootstrap-emacs[0x511e08]
../src/bootstrap-emacs[0x41941f]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x3dae020870]
../src/bootstrap-emacs[0x41b6a9]
/bin/bash: line 1: 10630 Aborted                 EMACSLOADPATH= '../src/bootstrap-emacs' -batch --no-site-file --no-site-lisp --eval "(setq max-lisp-eval-depth 2200)" --eval '(setq load-prefer-newer t)' -f batch-byte-compile emacs-lisp/byte-opt.el
Makefile:268: recipe for target 'emacs-lisp/byte-opt.elc' failed
make[3]: *** [emacs-lisp/byte-opt.elc] Error 134
/bin/bash: line 1: 10634 Aborted                 EMACSLOADPATH= '../src/bootstrap-emacs' -batch --no-site-file --no-site-lisp --eval "(setq max-lisp-eval-depth 2200)" --eval '(setq load-prefer-newer t)' -f batch-byte-compile emacs-lisp/bytecomp.el
Makefile:268: recipe for target 'emacs-lisp/bytecomp.elc' failed
make[3]: *** [emacs-lisp/bytecomp.elc] Error 134
make[3]: Leaving directory '/var/data/src/emacs/emacs/lisp'
Makefile:727: recipe for target 'bootstrap-emacs' failed
make[2]: *** [bootstrap-emacs] Error 2
make[2]: Leaving directory '/var/data/src/emacs/emacs/src'
Makefile:394: recipe for target 'src' failed
make[1]: *** [src] Error 2
make[1]: Leaving directory '/var/data/src/emacs/emacs'
Makefile:1087: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
b88e9cded7ae3756e3a2ec4a23e8df352a0239f9 is the first bad commit
commit b88e9cded7ae3756e3a2ec4a23e8df352a0239f9
Author: Paul Eggert <[email-masked]>
Date:   Tue Jan 26 23:00:10 2016 -0800

    malloc.h hygiene

    This attempts to future-proof Emacs a bit against possible glibc
    changes, by having Emacs use <malloc.h> declarations rather than
    coding them up by hand.  Problem noted by Florian Weimer in:
    https://sourceware.org/ml/libc-alpha/2016-01/msg00777.html
    Implement this mainly by moving malloc.h-related functions from
    emacs.c (which does not include <malloc.h>) to alloc.c (which does).
    * src/alloc.c (my_heap_start) [DOUG_LEA_MALLOC || GNU_LINUX]:
    New function.
    The remaining changes to this file apply only if DOUG_LEA_MALLOC.
    (alloc_unexec_pre, alloc_unexec_post): New functions.
    (malloc_initialize_hook): Use my_heap_start and alloc_unexec_post.
    (__MALLOC_HOOK_VOLATILE): New macro, if not already defined.
    (__malloc_initialize_hook): Use it.
    (malloc_state_ptr, malloc_initialize_hook, __malloc_initialize_hook):
    Move here from ...
    * src/emacs.c: ... here.
    (malloc_get_state, malloc_set_state): Remove extern decls.
    (my_heap_start) [DOUG_LEA_MALLOC || GNU_LINUX]: Remove static var.
    All uses changed to similarly-named new function.
    (Fdump_emacs): Use new functions alloc_unexec_pre, alloc_unexec_post.
    * src/lisp.h (my_heap_start, alloc_unexec_pre, alloc_unexec_post):
    New decls.

:040000 040000 e46f469e02031e990af4af272806980f066ef53e d36369c1e71f9630b0d9eeca83f4e04f3f411376 M	src
bisect run success
git bisect run ../build.sh  7533,93s user 264,26s system 369% cpu 35:12,15 total

8<------------8<------------8<------------8<------------8<------------

I've tried building master on two different up to date Debian SID
machines with similar results.

Note that I tried disabling `randomize_va_space` and running it with
`setarch x86_64 -R` and it failed too.

Thanks!

--
Elric Milon
PGP: 3939C2B494084E2F | http://whirm.eu