unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
To: Po Lu <luangruo@yahoo.com>
Cc: 65193@debbugs.gnu.org
Subject: bug#65193: 29.1.50; SET_FRAME_ICONIFIED can cause Lisp evaluation inside read_socket_hook.
Date: Fri, 11 Aug 2023 01:32:47 +0900	[thread overview]
Message-ID: <wledkaamds.wl-mituharu@math.s.chiba-u.ac.jp> (raw)
In-Reply-To: <87zg2zqcbg.fsf@yahoo.com>

On Thu, 10 Aug 2023 22:03:31 +0900,
Po Lu wrote:
> 
> YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:
> 
> > To my understanding, the Lisp evaluator is not reentrant, and thus
> > Lisp evaluation inside read_socket_hook, which can be called from
> > fairly arbitrary places via unblock_input/maybe_quit, causes
> > hard-to-reproduce, spontaneous crashes.
> 
> Only if that Lisp is permitted to signal out of those arbitrary places,
> since we no longer call read_socket_hook directly from signal handlers.
> Mode line format evaluation catches all non-local exits, AFAIK.
>
> > That's really surprising.  I've once heard we shouldn't do that.  Is
> > that changed?
> 
> I think so, see above.

I quote an old post by Stefan Monnier (author of SYNC_INPUT) below:

> SYNC_INPUT doesn't make much difference here: indeed the code is not
> executed from the signal handler any more, but it's still handled at
> fairly arbitrary points in the code, many of whom do not allow execution
> of elisp code.  So w.r.t execution of elisp code from read_socket_hook,
> it's still a big no-no.
(https://lists.gnu.org/r/emacs-devel/2008-03/msg01090.html)

What made Lisp evaluation inside read_socket_hook possible since then?

At least it can cause some corruption/inconsistency unless every
unblock_input/maybe_quit takes account of potential GC (including
string compaction).  Long-standing code would originally be written
without such a consideration.  Is it already audited thoroughly?

> > My understanding is that GC can only be triggered by eval_sub or
> > Ffuncall calls (except explicit garbage_collect calls), but not by
> > Lisp object allocations, for example.  Avoiding Lisp evaluation inside
> > read_socket_hook also means avoiding GC inside read_socket_hook.
> 
> Hmm.  But given that we haven't avoided Lisp evaluation within
> read_socket_hook for some time now, that's still a moot point.

Since which version?

Probably the possibility of encountering the problem would be quite
low and even if it happens, it is really difficult to reproduce, let
alone to identify the root cause.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp





  reply	other threads:[~2023-08-10 16:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10  7:41 bug#65193: 29.1.50; SET_FRAME_ICONIFIED can cause Lisp evaluation inside read_socket_hook YAMAMOTO Mitsuharu
2023-08-10  8:26 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-10  9:21   ` YAMAMOTO Mitsuharu
2023-08-10 13:03     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-10 16:32       ` YAMAMOTO Mitsuharu [this message]
2023-08-11  0:02         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-10 16:33       ` YAMAMOTO Mitsuharu
2023-08-10 17:58         ` Eli Zaretskii
2023-08-10 23:29           ` YAMAMOTO Mitsuharu
2023-08-12  7:30             ` Eli Zaretskii

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=wledkaamds.wl-mituharu@math.s.chiba-u.ac.jp \
    --to=mituharu@math.s.chiba-u.ac.jp \
    --cc=65193@debbugs.gnu.org \
    --cc=luangruo@yahoo.com \
    /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).