From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.bugs Subject: bug#22790: 24.5; Infinite loop involving malloc called from signal handler Date: Sun, 13 Mar 2016 01:21:47 -0800 Message-ID: <56E5312B.2050008@dancol.org> References: <83povmgfnn.fsf@gnu.org> <22228.22862.708667.152490@guava.gson.org> <838u1yzij7.fsf@gnu.org> <22233.39509.879175.437974@guava.gson.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6BqKOGx4eA4KpdP7gWRD1Hm8qWGfeHMVh" X-Trace: ger.gmane.org 1457860942 19421 80.91.229.3 (13 Mar 2016 09:22:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 13 Mar 2016 09:22:22 +0000 (UTC) Cc: 22790@debbugs.gnu.org To: Andreas Gustafsson , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 13 10:22:12 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1af2Dz-0001un-To for geb-bug-gnu-emacs@m.gmane.org; Sun, 13 Mar 2016 10:22:12 +0100 Original-Received: from localhost ([::1]:35122 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1af2Dy-0007iO-OY for geb-bug-gnu-emacs@m.gmane.org; Sun, 13 Mar 2016 05:22:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1af2Du-0007iJ-HV for bug-gnu-emacs@gnu.org; Sun, 13 Mar 2016 05:22:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1af2Dq-0007dS-Gj for bug-gnu-emacs@gnu.org; Sun, 13 Mar 2016 05:22:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49489) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1af2Dq-0007dO-DJ for bug-gnu-emacs@gnu.org; Sun, 13 Mar 2016 05:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1af2Dq-0004Fx-8u for bug-gnu-emacs@gnu.org; Sun, 13 Mar 2016 05:22:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Colascione Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Mar 2016 09:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22790 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 22790-submit@debbugs.gnu.org id=B22790.145786091416347 (code B ref 22790); Sun, 13 Mar 2016 09:22:02 +0000 Original-Received: (at 22790) by debbugs.gnu.org; 13 Mar 2016 09:21:54 +0000 Original-Received: from localhost ([127.0.0.1]:46616 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1af2Dh-0004Fb-Q7 for submit@debbugs.gnu.org; Sun, 13 Mar 2016 05:21:53 -0400 Original-Received: from dancol.org ([96.126.100.184]:55948) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1af2Df-0004FS-J4 for 22790@debbugs.gnu.org; Sun, 13 Mar 2016 05:21:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject; bh=dzDZsfWT3RWSMu46ZtyxzP86lZj0y/6RiCFMppHYGfU=; b=YSWl941BxqaOquJa0jVrby4/4yY7bpfnt8Kz0HY8+6vyHcHD4nULKYxKJ63plwrKv/9gXyZBefPEBcqDtTbD3V8mNYGrSRwClV/3foK5d3enwm7e+j6a31Jp0W6MAa8uUNvuz7lqRm7Utqnco64rFeT4LTGozoScBxTDIlUhuSyynFouDe9VqOte6pP6EnUPoD8CDu+HbQD7beLe4Dn1sy6xx4w/rSYLCy/A1Y6boohTPgcnFwUSaPOaJ8RlpsUOCp5w3XiDuryTlWnGenV1UGh4eAWZek1hxQ6m1a1tOxs5aHdIv0GX6IZb5eKmRBFABROq9uH77+Ab5AQXRSQ8Nw==; Original-Received: from [2601:602:8d80:ee8::e5a] by dancol.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84) (envelope-from ) id 1af2Dd-0004Dj-8F; Sun, 13 Mar 2016 01:21:49 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: <22233.39509.879175.437974@guava.gson.org> 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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:114847 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --6BqKOGx4eA4KpdP7gWRD1Hm8qWGfeHMVh Content-Type: multipart/mixed; boundary="GWhRlfRL9RMd3WiCE18FO1akbAlSPanFw" From: Daniel Colascione To: Andreas Gustafsson , Eli Zaretskii Cc: 22790@debbugs.gnu.org Message-ID: <56E5312B.2050008@dancol.org> Subject: Re: bug#22790: 24.5; Infinite loop involving malloc called from signal handler References: <83povmgfnn.fsf@gnu.org> <22228.22862.708667.152490@guava.gson.org> <838u1yzij7.fsf@gnu.org> <22233.39509.879175.437974@guava.gson.org> In-Reply-To: <22233.39509.879175.437974@guava.gson.org> --GWhRlfRL9RMd3WiCE18FO1akbAlSPanFw Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 03/04/2016 06:23 AM, Andreas Gustafsson wrote: > Eli Zaretskii wrote: >> Is this a GUI session or a text-mode terminal (a.k.a. "TTY") session? >=20 > This is a TTY session. >=20 >> In any case, this code is run as part of the so-called "emergency >> escape", when you type C-g more than once while Emacs is busy doing >> something that cannot be interrupted. In that situation, we are way >> past the point where invoking undefined behavior is of any concern, >> because the only thing we can do then is auto-save and commit >> suicide. >=20 > Not necessarily - there is also the option of continuing what emacs > was doing, which is what I would have done, by answering both the > "Auto-save?" and "Abort (and dump core)?" prompts with "no", if those > prompts had actually appeared. But they didn't, because emacs entered > an infinite loop trying to print them. >=20 >> You need to use "finish", not "step" or "stepi". >=20 > I will try that the next time the lockup happens, but I'm quite sure > it won't do anything useful. >=20 >> I don't think the loop can reasonably be inside libpthread, >=20 > Why not? We are talking undefined behavior here, after all. If you > find looping in libpthread surprising, just wait until the nasal > demons appear :) It could be something as simple as trying to acquire > a spinlock that was already held when the signal occurred. The Emacs maintainership has decided that undefined behavior in signal handlers is perfectly okay. I've patched this dangerous code out of my Emacs, and I suggest you do too. It's not just the printf calls that are unsafe --- it's everything that happens there. But there is little interest in making Emacs robust in this way. --GWhRlfRL9RMd3WiCE18FO1akbAlSPanFw-- --6BqKOGx4eA4KpdP7gWRD1Hm8qWGfeHMVh Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJW5TErAAoJEN4WImmbpWBl46QQAKdHa0rAG3QHhw0NnV4JBJx+ MHe6uggjQk34MZ1JzHOE6CtizRKIV4k3TWLxGFrxfvtgwmm9Fyvj30WYGuFGVhCn ZUg7agtRthkezUBVV1hHcf5H3xH7AylpAPbLwt2OkIc8OK7LNBC9/9yyG2eYh12K 7IbBAoMDPCm4zIdKkXx+db5LXIjM3QKKl8XcT9GInvhVRuuGJIBffp3iEFsGx4tk aMS49EFyvE/eCd9dC68GuiccO5ZxG4ohyIFBNHfOBG8yes/WXAnGjwESIFL/wslg nDQqY+sEz5Zie0N9V5q++Eu7i0Xosff6JaBab036iPYbpUMjTm4BkVEGt7M7k1By PF6jXcWSfhINwFTzdLHX+ReoRJ3hJpL1QMTa0wH5mc5VTv43wL6gCOYeVDUa/cEu ExJrVako1x7WxwDvMZZC0nLVVwnrZFJh6iqo9e7t1A63mIc5TP0M0nmsxHwW0cKm JNTfa2s20Ez53sfyLfV5HRYm6pIeAfQT9Nh9oqaqdSg4GzdQf3oUb6PIquDjUOl8 EhmMBdIFPWivhopTPbCRiFMlUmKOZ44a7c/XqEm52F62ehYPKl1NCcB5cmPlvBMe 2c3l4h1EU/Hc61xu+Llc03UxhknzZx1KsbdmwXQqQuwbiwgpKPlCpMtexaqq1r6V GOYnmikrG9urBKiIGbMr =fl/C -----END PGP SIGNATURE----- --6BqKOGx4eA4KpdP7gWRD1Hm8qWGfeHMVh--