From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#17406: 25.2; repeatable crash when hitting C-g twice Date: Sun, 17 Sep 2017 22:10:10 -0700 Organization: UCLA Computer Science Department Message-ID: <8dd2fcc7-c78f-f313-a9eb-cbe35344fe21@cs.ucla.edu> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------D8E6DDAD5EB4B2FC92F1EB0C" X-Trace: blaine.gmane.org 1505711474 13862 195.159.176.226 (18 Sep 2017 05:11:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 18 Sep 2017 05:11:14 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 Cc: 17406@debbugs.gnu.org, 28279@debbugs.gnu.org, Richard Stallman To: Eric Hoffman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 18 07:11:07 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dtoKo-0003If-NY for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Sep 2017 07:11:06 +0200 Original-Received: from localhost ([::1]:34703 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dtoKu-0002fV-DF for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Sep 2017 01:11:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dtoKn-0002f1-7a for bug-gnu-emacs@gnu.org; Mon, 18 Sep 2017 01:11:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dtoKj-0005ki-Ue for bug-gnu-emacs@gnu.org; Mon, 18 Sep 2017 01:11:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36800) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dtoKj-0005ke-R1 for bug-gnu-emacs@gnu.org; Mon, 18 Sep 2017 01:11:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dtoKj-0004Lu-Ka for bug-gnu-emacs@gnu.org; Mon, 18 Sep 2017 01:11:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Sep 2017 05:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17406 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17406-submit@debbugs.gnu.org id=B17406.150571142016563 (code B ref 17406); Mon, 18 Sep 2017 05:11:01 +0000 Original-Received: (at 17406) by debbugs.gnu.org; 18 Sep 2017 05:10:20 +0000 Original-Received: from localhost ([127.0.0.1]:45479 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dtoK4-0004J4-AJ for submit@debbugs.gnu.org; Mon, 18 Sep 2017 01:10:20 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:52996) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dtoK2-0004Io-1g; Mon, 18 Sep 2017 01:10:18 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 49CA6160D41; Sun, 17 Sep 2017 22:10:11 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id UACiW_yiZ6EX; Sun, 17 Sep 2017 22:10:10 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 7A67F160D8D; Sun, 17 Sep 2017 22:10:10 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 0J49WT-XSatU; Sun, 17 Sep 2017 22:10:10 -0700 (PDT) Original-Received: from [192.168.1.9] (unknown [47.154.18.85]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 52893160D41; Sun, 17 Sep 2017 22:10:10 -0700 (PDT) Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:137045 Archived-At: This is a multi-part message in MIME format. --------------D8E6DDAD5EB4B2FC92F1EB0C Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Eli's suggestion looks good. I tweaked his patch slightly to avoid some c= alls=20 and installed the attached into the emacs-26 branch to implement it. Plea= se give=20 it a try. --------------D8E6DDAD5EB4B2FC92F1EB0C Content-Type: text/x-patch; name="0001-Avoid-crash-with-C-g-C-g-in-GC.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-Avoid-crash-with-C-g-C-g-in-GC.patch" =46rom e56681085ee0575358b2193d69dd1a3c2ecf3dee Mon Sep 17 00:00:00 2001 From: Paul Eggert 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 =3D terminal->display_info.tty; =20 - XSETTERMINAL (lisp_terminal, terminal); - for (extra_codes =3D Fterminal_parameter (lisp_terminal, sym); + for (Lisp_Object extra_codes + =3D CDR_SAFE (assq_no_quit (sym, terminal->param_alist)); CONSP (extra_codes); extra_codes =3D XCDR (extra_codes)) { --=20 2.7.4 --------------D8E6DDAD5EB4B2FC92F1EB0C--