all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: elias.martenson@murex.com, 25178@debbugs.gnu.org
Subject: bug#25178: 26.0.50; Crash when pressing C-g in TTY mode
Date: Tue, 13 Dec 2016 21:37:27 +0200	[thread overview]
Message-ID: <8337hrboy0.fsf@gnu.org> (raw)
In-Reply-To: <878trj1vhp.fsf@linux-m68k.org> (message from Andreas Schwab on Tue, 13 Dec 2016 20:26:10 +0100)

> From: Andreas Schwab <schwab@linux-m68k.org>
> Cc: Elias Martenson <elias.martenson@murex.com>,  25178@debbugs.gnu.org
> Date: Tue, 13 Dec 2016 20:26:10 +0100
> 
> On Dez 13 2016, Eli Zaretskii <eliz@gnu.org> 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	other threads:[~2016-12-13 19:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-12  4:33 bug#25178: 26.0.50; Crash when pressing C-g in TTY mode Elias Martenson
2016-12-12 16:56 ` Eli Zaretskii
2016-12-13  2:52   ` Elias Martenson
2016-12-13  3:07   ` Elias Martenson
2016-12-13 18:45     ` Eli Zaretskii
2016-12-13 19:26       ` Andreas Schwab
2016-12-13 19:37         ` Eli Zaretskii [this message]
2016-12-13 20:12           ` Andreas Schwab
2016-12-14  3:13           ` Elias Martenson
2016-12-14  3:09       ` Elias Martenson
2016-12-14  3:39         ` Eli Zaretskii
2016-12-14  5:41           ` Elias Martenson
2016-12-17 13:58         ` Eli Zaretskii
2016-12-19  2:48           ` Elias Martenson
     [not found] ` <E1cJ1Z7-0000yc-Dd@eggs.gnu.org>
2017-01-05 23:39   ` npostavs
2017-01-06  7:47     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8337hrboy0.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=25178@debbugs.gnu.org \
    --cc=elias.martenson@murex.com \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.