From: Chong Yidong <cyd@stupidchicken.com>
Cc: rms@gnu.org, emacs-devel@gnu.org
Subject: Re: SEGV in x_catch_errors_unwind (x86_64-unknown-linux-gnu)
Date: Sat, 25 Feb 2006 10:36:01 -0500 [thread overview]
Message-ID: <87vev3v4bi.fsf@stupidchicken.com> (raw)
In-Reply-To: <87zmkfv51z.fsf@stupidchicken.com> (Chong Yidong's message of "Sat, 25 Feb 2006 10:20:08 -0500")
Chong Yidong <cyd@stupidchicken.com> writes:
>> However, as I was looking at the following loop unbind_to in eval.c,
>> it occurred to me that one way the x_catch_errors_unwind function
>> could be called twice in succession would be if specpdl_ptr is
>> incremented by the addition of additional bindings while the loop is
>> running (by some other code that is misbehaving while manipulating the
>> specpdl array).
There isn't any misbehaving code, btw. Since unbind_to is currently
run without BLOCK_INPUT, it can be interrupted by a signal handler.
The signal handler can call the x error handler, which calls
record_unwind_protect, which screws things up.
One solution is to somehow re-engineer the x error handler not to use
record_unwind_protect. The other is to block inputs at the point in
unbind_to where specpdl_ptr is being modified, like this:
*** emacs/src/eval.c.~1.261.~ 2006-02-09 23:33:56.000000000 -0500
--- emacs/src/eval.c 2006-02-25 10:26:26.000000000 -0500
***************
*** 3214,3233 ****
{
Lisp_Object quitf = Vquit_flag;
struct gcpro gcpro1, gcpro2;
GCPRO2 (value, quitf);
Vquit_flag = Qnil;
! while (specpdl_ptr != specpdl + count)
{
/* Copy the binding, and decrement specpdl_ptr, before we do
the work to unbind it. We decrement first
so that an error in unbinding won't try to unbind
the same entry again, and we copy the binding first
in case more bindings are made during some of the code we run. */
- struct specbinding this_binding;
this_binding = *--specpdl_ptr;
if (this_binding.func != 0)
(*this_binding.func) (this_binding.old_value);
--- 3214,3238 ----
{
Lisp_Object quitf = Vquit_flag;
struct gcpro gcpro1, gcpro2;
+ struct specbinding this_binding;
GCPRO2 (value, quitf);
Vquit_flag = Qnil;
! while (1)
{
+ BLOCK_INPUT;
+ if (specpdl_ptr == specpdl + count)
+ break;
+
/* Copy the binding, and decrement specpdl_ptr, before we do
the work to unbind it. We decrement first
so that an error in unbinding won't try to unbind
the same entry again, and we copy the binding first
in case more bindings are made during some of the code we run. */
this_binding = *--specpdl_ptr;
+ UNBLOCK_INPUT;
if (this_binding.func != 0)
(*this_binding.func) (this_binding.old_value);
***************
*** 3263,3268 ****
--- 3268,3274 ----
set_internal (this_binding.symbol, this_binding.old_value, 0, 1);
}
}
+ UNBLOCK_INPUT;
if (NILP (Vquit_flag) && !NILP (quitf))
Vquit_flag = quitf;
next prev parent reply other threads:[~2006-02-25 15:36 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-21 21:33 SEGV in x_catch_errors_unwind (x86_64-unknown-linux-gnu) John W. Eaton
2006-02-23 2:39 ` Richard Stallman
2006-02-24 9:55 ` Richard Stallman
2006-02-25 7:45 ` John W. Eaton
2006-02-25 15:20 ` Chong Yidong
2006-02-25 15:36 ` Chong Yidong [this message]
2006-02-25 17:47 ` John W. Eaton
2006-02-25 23:29 ` Chong Yidong
2006-02-26 3:37 ` John W. Eaton
2006-02-27 8:58 ` Richard Stallman
2006-02-28 0:51 ` Chong Yidong
2006-03-05 0:59 ` Richard Stallman
2006-02-26 16:00 ` Richard Stallman
2006-02-26 12:11 ` Richard Stallman
-- strict thread matches above, loose matches on Subject: below --
2006-02-17 8:04 John W. Eaton
[not found] <v9oe1hg44k.fsf@marauder.physik.uni-ulm.de>
2006-02-13 4:40 ` Richard M. Stallman
2006-02-13 14:04 ` Reiner Steib
2006-02-13 17:05 ` Stefan Monnier
2006-02-14 0:40 ` Richard M. Stallman
2006-02-17 14:27 ` Reiner Steib
2006-02-17 15:20 ` Reproducible crashes: dropping an URL (was: SEGV in x_catch_errors_unwind (x86_64-unknown-linux-gnu)) Reiner Steib
2006-02-17 16:01 ` Reproducible crashes: dropping an URL Stefan Monnier
2006-02-20 14:59 ` SEGV in x_catch_errors_unwind (x86_64-unknown-linux-gnu) (was: Reproducible crashes: dropping an URL) Reiner Steib
2006-02-20 15:04 ` SEGV in x_catch_errors_unwind (x86_64-unknown-linux-gnu) Stefan Monnier
2006-02-20 20:05 ` Reiner Steib
2006-02-21 4:39 ` Chong Yidong
2006-02-22 5:23 ` Richard M. Stallman
2006-02-21 5:30 ` Richard M. Stallman
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vev3v4bi.fsf@stupidchicken.com \
--to=cyd@stupidchicken.com \
--cc=emacs-devel@gnu.org \
--cc=rms@gnu.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 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).