bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Eli Zaretskii
Subject: bug#25178: 26.0.50; Crash when pressing C-g in TTY mode
Date: Tue, 13 Dec 2016 21:37:27 +0200

> From: Andreas Schwab <address@hidden>
> Cc: Elias Martenson <address@hidden>,  address@hidden
> Date: Tue, 13 Dec 2016 20:26:10 +0100
> 
> On Dez 13 2016, Eli Zaretskii <address@hidden> 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.

Thanks.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]