GNU bug report logs - #29040
emacs-26 crash due to misaligned longjmp buffer in 64-bit MSYS2/MinGW-W64 build

Previous Next

Package: emacs;

Reported by: Richard Copley <rcopley <at> gmail.com>

Date: Sat, 28 Oct 2017 13:42:02 UTC

Severity: normal

Tags: fixed

Done: Richard Copley <rcopley <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Richard Copley <rcopley <at> gmail.com>
Cc: 29040 <at> debbugs.gnu.org
Subject: bug#29040: Emacs 25 hangs on windows arbitrarily during search of a unicode file
Date: Sat, 28 Oct 2017 19:41:33 +0300
> From: Richard Copley <rcopley <at> gmail.com>
> Date: Sat, 28 Oct 2017 17:16:14 +0100
> Cc: 29040 <at> debbugs.gnu.org
> 
> > Actually, I think it was caused by 015f0bb.  Does the patch below fix
> > the problem?  Please actually check the alignment of getcjmp, not just
> > that the crashes went away.
> >
> > diff --git a/src/thread.c b/src/thread.c
> > index 6f12d79..2520771 100644
> > --- a/src/thread.c
> > +++ b/src/thread.c
> > @@ -26,7 +26,11 @@ along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
> >  #include "coding.h"
> >  #include "syssignal.h"
> >
> > -static struct thread_state alignas (GCALIGNMENT) main_thread;
> > +#define COMMON_MULTIPLE(a, b) \
> > +  ((a) % (b) == 0 ? (a) : (b) % (a) == 0 ? (b) : (a) * (b))
> > +#define THREAD_ALIGNMENT COMMON_MULTIPLE (alignof (max_align_t), GCALIGNMENT)
> > +
> > +static struct thread_state alignas (THREAD_ALIGNMENT) main_thread;
> >
> >  struct thread_state *current_thread = &main_thread;
> 
> Looks good. There's no crash and getcjmp is aligned:
> 
> Thread 1 hit Breakpoint 3, quit_throw_to_read_char (
>     from_signal=from_signal <at> entry=false) at keyboard.c:10548
> 10548     sys_longjmp (getcjmp, 1);
> (gdb) p &getcjmp
> $1 = (sys_jmp_buf *) 0x4005cdaf0 <main_thread+224>

Thanks, I installed that.

If the problem doesn't come back, please close the bug.




This bug report was last modified 7 years and 208 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.