unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17406: C-g C-g in GC causes crash
@ 2014-05-05  7:00 Richard Stallman
  2017-09-18  5:10 ` bug#17406: 25.2; repeatable crash when hitting C-g twice Paul Eggert
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Stallman @ 2014-05-05  7:00 UTC (permalink / raw)
  To: 17406

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

When GC starts taking a long time, I can easily type C-g C-g during a
GC if I have garbage-collection-messages set.  This stops Emacs as it
should.  When I continue it, it asks (correctly) if I want to abort
and dump core.  I say no, and then it crashes.

A backtrace showed me why: tty_send_additional_strings calls
Fterminal_parameter which calls Fassq which does QUIT;

-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org  www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use Ekiga or an ordinary phone call.






^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#17406: 25.2; repeatable crash when hitting C-g twice
  2014-05-05  7:00 bug#17406: C-g C-g in GC causes crash Richard Stallman
@ 2017-09-18  5:10 ` Paul Eggert
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggert @ 2017-09-18  5:10 UTC (permalink / raw)
  To: Eric Hoffman; +Cc: 17406, 28279, Richard Stallman

[-- Attachment #1: Type: text/plain, Size: 174 bytes --]

Eli's suggestion looks good. I tweaked his patch slightly to avoid some calls 
and installed the attached into the emacs-26 branch to implement it. Please give 
it a try.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Avoid-crash-with-C-g-C-g-in-GC.patch --]
[-- Type: text/x-patch; name="0001-Avoid-crash-with-C-g-C-g-in-GC.patch", Size: 1499 bytes --]

From e56681085ee0575358b2193d69dd1a3c2ecf3dee Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 17 Sep 2017 22:01:56 -0700
Subject: [PATCH] Avoid crash with C-g C-g in GC

Problem reported by Richard Stallman (Bug#17406).
Based on fix suggested by Eli Zaretskii (Bug#28279#16).
* src/term.c (tty_send_additional_strings):
Use only safe accessors, to avoid crash when C-g C-g in GC.
---
 src/term.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/term.c b/src/term.c
index a2ae8c2..065bce4 100644
--- a/src/term.c
+++ b/src/term.c
@@ -155,12 +155,16 @@ tty_ring_bell (struct frame *f)
 static void
 tty_send_additional_strings (struct terminal *terminal, Lisp_Object sym)
 {
-  Lisp_Object lisp_terminal;
-  Lisp_Object extra_codes;
+  /* Use only accessors like CDR_SAFE and assq_no_quit to avoid any
+     form of quitting or signaling an error, since this function can
+     run as part of the "emergency escape" procedure invoked in the
+     middle of GC, where quitting means crashing (Bug#17406).  */
+  if (! terminal->name)
+    return;
   struct tty_display_info *tty = terminal->display_info.tty;
 
-  XSETTERMINAL (lisp_terminal, terminal);
-  for (extra_codes = Fterminal_parameter (lisp_terminal, sym);
+  for (Lisp_Object extra_codes
+	 = CDR_SAFE (assq_no_quit (sym, terminal->param_alist));
        CONSP (extra_codes);
        extra_codes = XCDR (extra_codes))
     {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-18  5:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-05  7:00 bug#17406: C-g C-g in GC causes crash Richard Stallman
2017-09-18  5:10 ` bug#17406: 25.2; repeatable crash when hitting C-g twice Paul Eggert

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).