Subject: Re: bug#25178: 26.0.50; Crash when pressing C-g in TTY mode

From: Elias Martenson <[email-masked]>
Date: Wed, 14 Dec 2016 11:13:35 +0800

Eli Zaretskii <[email-masked]> writes:

> > From: Andreas Schwab <[email-masked]>
> > Cc: Elias Martenson <[email-masked]>,  [email-masked]
> > Date: Tue, 13 Dec 2016 20:26:10 +0100
> > 
> > On Dez 13 2016, Eli Zaretskii <[email-masked]> wrote:
> > 
> > > Hmm...  Is calling pthread_mutex_unlock twice in a row, without an
> > > intervening call to pthread_mutex_lock, supposed to segfault?
> > 
> > It's undefined, so anything can happen.  Just don't do that.
> 
> At this point, I'd like to establish whether the fact Emacs does do it
> could explain crashes reported by Elias which I cannot reproduce on a
> different GNU/Linux system.
> 
> What I think happens is that C-g on a TTY produces a SIGINT that
> interrupts the call to pselect and runs handle_interrupt, which then
> longjmps back to read_char, which then calls thread_select.  But since
> pselect inside the previous call to thread_select was interrupted, the
> following call to acquire_global_lock was not done, and we are now
> running with the global lock unlocked.  Then thread_select calls
> release_global_lock which attempts to unlock the (unlocked) mutex.
> 
> The question is whether this is just bad, or causes the crash.  It
> doesn't crash for me.

I'm using Arch Linux, which tends to use quite bleeding edge versions
pretty much everything.

Since I don't recall seeing this issue until recently, I'm
suspecting—although I have no proof of this—that they might have
recently introduced a change that causes this to crash instead of
silently accepting it, perhaps as a way to find bugs like this?

Regards,
Elias
*******************************

This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.