Subject: bug#30855: 25.3; temacs fails with bus error during garbage collection

From: Ulrich Mueller <[email-masked]>
Date: Tue, 20 Mar 2018 15:00:28 +0100

>>>>> On Mon, 19 Mar 2018, Eli Zaretskii wrote:

> Thanks.  We are not planning any further v25.x releases, so if this
> problem doesn't happen with the latest pretest of Emacs 26.1, we
> will consider it resolved.

Well, function mark_memory hasn't been touched since 25.3, and the bug
won't have resolved itself in some magical way. ;-)

  for (pp = start; (void *) pp < end; pp += GC_POINTER_ALIGNMENT)
    {
      mark_maybe_pointer (*(void **) pp);
      mark_maybe_object (*(Lisp_Object *) pp);
    }

The loop is in steps of 4 but tries to access objects of size 8.

Backtrace with Emacs 26.0.91 (thanks to Rolf Eike Beer):
#0  0x002211a0 in mark_memory (start=0xffffacd8, end=0xffffc840) at alloc.c:4986
        pp = 0xffffacdc ""
#1  0x002211fc in mark_stack (bottom=0xffffc840 "", end=0xffffacd8 "") at alloc.c:5193
No locals.
#2  0x0031d1c8 in mark_one_thread (thread=0x66ab88 <main_thread>) at thread.c:616
        stack_top = 0xffffacd8
#3  0x0031d328 in mark_threads_callback (ignore=0x0) at thread.c:649
        thread_obj = -6917529027634353272
        iter = 0x66ab88 <main_thread>
#4  0x00221258 in flush_stack_call_func (func=0x31d2dc <mark_threads_callback>, arg=0x0) at alloc.c:5220
        end = 0xffffacd8
        self = 0x66ab88 <main_thread>
        sentry = {o = {__max_align_ll = -91431263796984, __max_align_ld = 0}}
#5  0x0031d368 in mark_threads () at thread.c:656
No locals.
#6  0x0022333c in garbage_collect_1 (end=0xffffaf00) at alloc.c:5997
        nextb = 0x0
        stack_top_variable = 0 '\000'
        i = 538
        message_p = false
        count = 25
        start = {tv_sec = 1521554084, tv_nsec = 118444958}
        retval = 0
        tot_before = 0
        total = {0, 0, 0, 4611686018427387904, 0, 4611686018427387904, -6917529027634762960, 4611686018434174144, 4611686018433697584, 0}
#7  0x00223f74 in Fgarbage_collect () at alloc.c:6168
        end = 0xffffaf00
        sentry = {o = {__max_align_ll = -89060441849851, __max_align_ld = 2}}
[...]