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

From: Eli Zaretskii <[email-masked]>
Date: Wed, 14 Dec 2016 05:39:38 +0200

> From: Elias Martenson <[email-masked]>
> CC: <[email-masked]>
> Date: Wed, 14 Dec 2016 11:09:12 +0800
> 
> > Strangely, I don't see this on the GNU/Linux system to which I have
> > access, although Emacs definitely calls pthread_mutex_unlock twice in
> > a row in the scenario of this bug report.  Is this some change in
> > latest versions of glibc?
> 
> Calling pthread_mutex_unlock() twice has to be undefined behaviour. In
> fact, it can never work. Imagine what would happen if a different thread
> called pthread_mutex_lock() on the mutex between two the two unlock
> calls. In that case, you'd be unlocking a mutex help by a different
> thread which is obviously very dangerous.

I'm not asking if this is undefined behavior; it clearly is.  I'm
asking whether the second of these two calls is actually the one that
crashes Emacs with SIGSEGV.  IOW, does the crash happen inside the
second call to pthread_mutex_unlock?  And the next question would be
why doesn't it crash for me on another GNU/Linux system?

Thanks.