From unknown Fri Aug 15 18:52:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20996: 25.0.50; Incomplete recovery from stack overflow Resent-From: Ken Brown Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Jul 2015 20:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20996 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 20996@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.143621533522368 (code B ref -1); Mon, 06 Jul 2015 20:43:02 +0000 Received: (at submit) by debbugs.gnu.org; 6 Jul 2015 20:42:15 +0000 Received: from localhost ([127.0.0.1]:42455 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZCDDS-0005og-AL for submit@debbugs.gnu.org; Mon, 06 Jul 2015 16:42:14 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60195) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZCDDP-0005oT-JO for submit@debbugs.gnu.org; Mon, 06 Jul 2015 16:42:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCDDI-0001Ll-Ub for submit@debbugs.gnu.org; Mon, 06 Jul 2015 16:42:06 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:34110) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCDDI-0001Lf-Rq for submit@debbugs.gnu.org; Mon, 06 Jul 2015 16:42:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45460) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCDDH-00079V-Di for bug-gnu-emacs@gnu.org; Mon, 06 Jul 2015 16:42:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCDDE-0001Ke-6D for bug-gnu-emacs@gnu.org; Mon, 06 Jul 2015 16:42:03 -0400 Received: from limerock01.mail.cornell.edu ([128.84.13.241]:54941) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCDDE-0001Fj-1E for bug-gnu-emacs@gnu.org; Mon, 06 Jul 2015 16:42:00 -0400 X-CornellRouted: This message has been Routed already. Received: from authusersmtp.mail.cornell.edu (granite4.serverfarm.cornell.edu [10.16.197.9]) by limerock01.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id t66KfsYn021186 for ; Mon, 6 Jul 2015 16:41:55 -0400 Received: from [10.128.129.1] (dhcp-gs-257.eduroam.cornell.edu [10.128.129.1]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id t66KfsOs005566 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Mon, 6 Jul 2015 16:41:54 -0400 Message-ID: <559AE812.2080803@cornell.edu> Date: Mon, 06 Jul 2015 16:41:54 -0400 From: Ken Brown User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.3 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.3 (----) Cygwin has just implemented an alternate stack in its development trunk, and I've been testing it by seeing if emacs can recover from a stack overflow (see handle_sigsegv() in sysdep.c). This isn't working as I expect, and I don't know if it's a Cygwin problem or an emacs problem. (For starters, it would help if someone would try to reproduce it on GNU/Linux.) To reproduce the problem, run 'emacs -Q' and then force a stack overflow as suggested in https://lists.gnu.org/archive/html/emacs-devel/2014-08/msg00481.html, i.e., by evaluating the following: (setq max-specpdl-size 83200000 max-lisp-eval-depth 640000) (defun foo () (foo)) (foo) When I do this, handle_sigsegv is called and I get the message "Re-entering top level after C stack overflow", as expected. But if I then type 'C-x d', I get an immediate crash with the following backtrace: Program received signal SIGSEGV, Segmentation fault. 0x000000010053aff0 in SDATA (string=-2338913020442312704) at ../../master/src/lisp.h:1281 1281 return XSTRING (string)->data; (gdb) bt full #0 0x000000010053aff0 in SDATA (string=-2338913020442312704) at ../../master/src/lisp.h:1281 No locals. #1 0x0000000100628636 in unmark_byte_stack () at ../../master/src/bytecode.c:380 stack = 0x100df8a63 #2 0x00000001005c0bcb in garbage_collect_1 (end=0x82b838) at ../../master/src/alloc.c:5735 nextb = 0x0 stack_top_variable = 0 '\000' i = 585 message_p = false count = 17 start = { tv_sec = 1436214527, tv_nsec = 316292100 } retval = 0 tot_before = 0 total = {25782979923, 25782959104, 8565584, 45696, 8566592, 4300451200, 4305864144, 0, 8566624, 4300451200} #3 0x00000001005c1208 in Fgarbage_collect () at ../../master/src/alloc.c:5937 end = 0x82b838 #4 0x0000000000000000 in ?? () No symbol table info available. Backtrace stopped: previous frame inner to this frame (corrupt stack?) Lisp Backtrace: "Automatic GC" (0x0) "autoload-do-load" (0x82c0c0) "command-execute" (0x82c628) And handle_sigsegv can't do anything about this because garbage collection is in process. So we haven't really made a complete recovery from the stack overflow. In GNU Emacs 25.0.50.15 (x86_64-unknown-cygwin, GTK+ Version 3.14.13) of 2015-07-06 on moufang Repository revision: f3480939ffccf7a72b060b4fc21dd85b55f535f6 Windowing system distributor `The Cygwin/X Project', version 11.0.11701000 Configured using: `configure 'CFLAGS=-g3 -O0'' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message dired format-spec rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns cl-loaddefs pcase cl-lib mail-prsvr mail-utils time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind gfilenotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) From unknown Fri Aug 15 18:52:53 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Ken Brown Subject: bug#20996: closed (Re: 25.0.50; Incomplete recovery from stack overflow) Message-ID: References: <55A51707.5090800@cs.ucla.edu> <559AE812.2080803@cornell.edu> X-Gnu-PR-Message: they-closed 20996 X-Gnu-PR-Package: emacs Reply-To: 20996@debbugs.gnu.org Date: Tue, 14 Jul 2015 14:06:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1436882762-32756-1" This is a multi-part message in MIME format... ------------=_1436882762-32756-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #20996: 25.0.50; Incomplete recovery from stack overflow which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 20996@debbugs.gnu.org. --=20 20996: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D20996 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1436882762-32756-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 20996-done) by debbugs.gnu.org; 14 Jul 2015 14:05:04 +0000 Received: from localhost ([127.0.0.1]:49130 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZF0pT-0008Tq-Ta for submit@debbugs.gnu.org; Tue, 14 Jul 2015 10:05:04 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:41094) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZF0pS-0008TF-Ca for 20996-done@debbugs.gnu.org; Tue, 14 Jul 2015 10:05:03 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6D98F160198; Tue, 14 Jul 2015 07:04:56 -0700 (PDT) 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 rCslZA_0LB8Q; Tue, 14 Jul 2015 07:04:55 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id CAF1A160999; Tue, 14 Jul 2015 07:04:55 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 4-L3yyxHSUir; Tue, 14 Jul 2015 07:04:55 -0700 (PDT) Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id AE056160198; Tue, 14 Jul 2015 07:04:55 -0700 (PDT) Message-ID: <55A51707.5090800@cs.ucla.edu> Date: Tue, 14 Jul 2015 07:04:55 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Ken Brown Subject: Re: 25.0.50; Incomplete recovery from stack overflow Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 20996-done Cc: 20996-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) Thanks for reporting that bug, especially the recipe. I reproduced the problem and installed a fix as master commit 2254b6c09cff8f3a83684fd159289d0e305b0e7d. ------------=_1436882762-32756-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 6 Jul 2015 20:42:15 +0000 Received: from localhost ([127.0.0.1]:42455 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZCDDS-0005og-AL for submit@debbugs.gnu.org; Mon, 06 Jul 2015 16:42:14 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60195) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZCDDP-0005oT-JO for submit@debbugs.gnu.org; Mon, 06 Jul 2015 16:42:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCDDI-0001Ll-Ub for submit@debbugs.gnu.org; Mon, 06 Jul 2015 16:42:06 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:34110) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCDDI-0001Lf-Rq for submit@debbugs.gnu.org; Mon, 06 Jul 2015 16:42:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45460) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCDDH-00079V-Di for bug-gnu-emacs@gnu.org; Mon, 06 Jul 2015 16:42:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCDDE-0001Ke-6D for bug-gnu-emacs@gnu.org; Mon, 06 Jul 2015 16:42:03 -0400 Received: from limerock01.mail.cornell.edu ([128.84.13.241]:54941) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCDDE-0001Fj-1E for bug-gnu-emacs@gnu.org; Mon, 06 Jul 2015 16:42:00 -0400 X-CornellRouted: This message has been Routed already. Received: from authusersmtp.mail.cornell.edu (granite4.serverfarm.cornell.edu [10.16.197.9]) by limerock01.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id t66KfsYn021186 for ; Mon, 6 Jul 2015 16:41:55 -0400 Received: from [10.128.129.1] (dhcp-gs-257.eduroam.cornell.edu [10.128.129.1]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id t66KfsOs005566 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Mon, 6 Jul 2015 16:41:54 -0400 Message-ID: <559AE812.2080803@cornell.edu> Date: Mon, 06 Jul 2015 16:41:54 -0400 From: Ken Brown User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: bug-gnu-emacs@gnu.org Subject: 25.0.50; Incomplete recovery from stack overflow Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.3 (----) Cygwin has just implemented an alternate stack in its development trunk, and I've been testing it by seeing if emacs can recover from a stack overflow (see handle_sigsegv() in sysdep.c). This isn't working as I expect, and I don't know if it's a Cygwin problem or an emacs problem. (For starters, it would help if someone would try to reproduce it on GNU/Linux.) To reproduce the problem, run 'emacs -Q' and then force a stack overflow as suggested in https://lists.gnu.org/archive/html/emacs-devel/2014-08/msg00481.html, i.e., by evaluating the following: (setq max-specpdl-size 83200000 max-lisp-eval-depth 640000) (defun foo () (foo)) (foo) When I do this, handle_sigsegv is called and I get the message "Re-entering top level after C stack overflow", as expected. But if I then type 'C-x d', I get an immediate crash with the following backtrace: Program received signal SIGSEGV, Segmentation fault. 0x000000010053aff0 in SDATA (string=-2338913020442312704) at ../../master/src/lisp.h:1281 1281 return XSTRING (string)->data; (gdb) bt full #0 0x000000010053aff0 in SDATA (string=-2338913020442312704) at ../../master/src/lisp.h:1281 No locals. #1 0x0000000100628636 in unmark_byte_stack () at ../../master/src/bytecode.c:380 stack = 0x100df8a63 #2 0x00000001005c0bcb in garbage_collect_1 (end=0x82b838) at ../../master/src/alloc.c:5735 nextb = 0x0 stack_top_variable = 0 '\000' i = 585 message_p = false count = 17 start = { tv_sec = 1436214527, tv_nsec = 316292100 } retval = 0 tot_before = 0 total = {25782979923, 25782959104, 8565584, 45696, 8566592, 4300451200, 4305864144, 0, 8566624, 4300451200} #3 0x00000001005c1208 in Fgarbage_collect () at ../../master/src/alloc.c:5937 end = 0x82b838 #4 0x0000000000000000 in ?? () No symbol table info available. Backtrace stopped: previous frame inner to this frame (corrupt stack?) Lisp Backtrace: "Automatic GC" (0x0) "autoload-do-load" (0x82c0c0) "command-execute" (0x82c628) And handle_sigsegv can't do anything about this because garbage collection is in process. So we haven't really made a complete recovery from the stack overflow. In GNU Emacs 25.0.50.15 (x86_64-unknown-cygwin, GTK+ Version 3.14.13) of 2015-07-06 on moufang Repository revision: f3480939ffccf7a72b060b4fc21dd85b55f535f6 Windowing system distributor `The Cygwin/X Project', version 11.0.11701000 Configured using: `configure 'CFLAGS=-g3 -O0'' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message dired format-spec rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns cl-loaddefs pcase cl-lib mail-prsvr mail-utils time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind gfilenotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) ------------=_1436882762-32756-1--