Subject: Re: bug#24764: 25.1.50; Another crash in automatic gc

From: Eli Zaretskii <[email-masked]>
Date: Sun, 23 Oct 2016 20:01:53 +0300

> From: Michael Heerdegen <[email-masked]>
> Cc: [email-masked]
> Date: Sun, 23 Oct 2016 18:37:39 +0200
> 
> Done.  I tried dict.cc with "löschen" and got a crash immediately.
> 
> Here are the backtraces:
> [...]
> Thread 1 "emacs" hit Breakpoint 1, terminate_due_to_signal (sig=6, backtrace_limit=2147483647) at emacs.c:354
> 354	  signal (sig, SIG_DFL);
> (gdb) backtrace
> #0  terminate_due_to_signal (sig=6, backtrace_limit=2147483647) at emacs.c:354
> #1  0x00000000006063d4 in die (msg=0x749e60 "buftext == BYTE_POS_ADDR (istart_byte)", file=0x749e57 "xml.c", line=220) at alloc.c:7228
> #2  0x00000000006a6ce6 in parse_region (start=1018, end=317370, base_url=0, discard_comments=0, htmlp=true) at xml.c:220
> #3  0x00000000006a6e60 in Flibxml_parse_html_region (start=1018, end=317370, base_url=0, discard_comments=0) at xml.c:270

Why am I not surprised?

Please update from the Git repo and rebuild.  I've added a workaround
for this problem.  It should prevent the assertion violation in xml.c,
but the really interesting question is whether your other crashes in
GC will also go away?  If not, there are more places like this one
that need to be fixed.

Note that the workaround I committed could potentially cause (very
rare) crashes in ralloc.c itself; if that happens, it's more or less
expected, and is not related to the reasons for the GC crashes.

> Should I keep that session open

No need, thanks.  The reason for the assertion violation here is
perfectly clear: libxml2 calls malloc while doing its job, and that
relocates buffer text whose pointer we pass to libxml2.  Once the
bufefr text is relocated, libxml2 continues reading from invalid
memory, which could cause all kinds of trouble.

> or still try to downgrade libc

I'd like you to try the current emacs-25 branch first, to see if it is
more reliable in your routine work than the previous version (before
the assertion I added).

Thanks.