unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Po Lu <luangruo@yahoo.com>
Cc: "Gerd Möllmann" <gerd.moellmann@gmail.com>,
	"Eli Zaretskii" <eliz@gnu.org>,
	58042@debbugs.gnu.org, "Alan Third" <alan@idiocy.org>
Subject: bug#58042: 29.0.50; ASAN use-after-free in re_match_2_internal
Date: Mon, 08 May 2023 10:01:47 -0400	[thread overview]
Message-ID: <jwvjzxjnd1y.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <877d1ewnx0.fsf@yahoo.com> (Po Lu's message of "Wed, 05 Oct 2022 18:43:55 +0800")

>>> Isn't the -[EmacsView layoutSublayersOfLayer:] the problem?  AFAICT from
>>> a web search, this is an event handler method that is also called from
>>> by the framework?
>>>
>>> In the olden days, it was a serious error to call into Lisp from an
>>> event handler.  All bets were off when that happened, not only related
>>> to GC.  I believe that hasn't changed much.
>
> Today, event handling code calls Lisp all the time (through safe_call
> etc.)  That happens in handle_one_xevent, ns_select, et cetera.

Really?

> It shouldn't affect GC at all because input is blocked for the entire
> duration of each GC, except for when finalizers are run after unmarked
> objects are sweeped.

The problem was not if it's run from within the GC, the problem was what
this code does when *it* runs the GC (or other state-changing functions).
[ And indeed, the fix Gerd installed was to prevent GC while running
  pending_signals.  But I suspect this is not sufficient because there
  are other forms of global state that can get messed up.  ]

In bug#62732 we have a related problem when code run from `maybe_quit`
(an atimer in that case) from the regexp engine, and that atimer
itself performs a regexp-operation, which messes up the outer regexp
engine invocation because the regexp engine is still not re-entrant (in
that bug, the problem is the `gl_state` global variable).


        Stefan







  parent reply	other threads:[~2023-05-08 14:01 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-24 13:45 bug#58042: 29.0.50; ASAN use-after-free in re_match_2_internal Gerd Möllmann
2022-09-24 14:17 ` Gerd Möllmann
2022-09-24 14:48   ` Gerd Möllmann
2022-09-24 14:56   ` Eli Zaretskii
2022-09-24 15:08     ` Gerd Möllmann
2022-09-24 15:24       ` Eli Zaretskii
2022-09-25  5:50         ` Gerd Möllmann
2022-09-25  6:32           ` Eli Zaretskii
2022-09-25  7:06             ` Gerd Möllmann
2022-09-25  8:08               ` Eli Zaretskii
2022-09-25  8:28                 ` Gerd Möllmann
2022-09-25  8:43                   ` Eli Zaretskii
2022-09-26  5:13                     ` Gerd Möllmann
2022-10-04 14:33 ` Gerd Möllmann
2022-10-04 16:35   ` Eli Zaretskii
2022-10-05  4:37     ` Gerd Möllmann
2022-10-05  6:16       ` Eli Zaretskii
2022-10-05  6:58         ` Gerd Möllmann
2022-10-05  7:22           ` Eli Zaretskii
2022-10-05  7:34             ` Gerd Möllmann
2022-10-05  9:00               ` Gerd Möllmann
2022-10-05  9:23                 ` Eli Zaretskii
2022-10-05 10:14                   ` Gerd Möllmann
2022-10-05 10:24                     ` Gerd Möllmann
2022-10-05 10:43                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-05 10:49                         ` Gerd Möllmann
2022-10-05 11:10                           ` Gerd Möllmann
2022-10-05 11:15                             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-05 11:37                               ` Gerd Möllmann
2022-10-05 13:37                               ` Eli Zaretskii
2022-10-05 13:52                                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-05 14:09                                   ` Eli Zaretskii
2022-10-05 14:24                                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-05 13:27                             ` Eli Zaretskii
2022-10-05 13:31                               ` Gerd Möllmann
2022-10-05 13:55                                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-08 14:01                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-05-09  1:04                           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-09  2:25                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-09  5:30                             ` Eli Zaretskii
2022-10-05 10:45                       ` Gerd Möllmann
2022-10-05 11:10                         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-05 11:15                           ` Gerd Möllmann
2022-10-05 11:23                             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-05 11:35                               ` Gerd Möllmann
2022-10-05 12:02                               ` Gerd Möllmann
2022-10-05 12:08                                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-05 13:40                               ` Eli Zaretskii
2022-10-05 13:53                                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-05 14:10                                   ` Eli Zaretskii
2022-10-05 12:05                             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-05 12:32                               ` Gerd Möllmann
2022-10-05 12:38                                 ` Gerd Möllmann
2022-10-05 12:49                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-05 12:48                                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-06  5:20                                   ` Gerd Möllmann
2022-10-05 13:39                           ` Eli Zaretskii
2022-10-05 13:13                         ` Eli Zaretskii
2022-10-05 13:24                           ` Gerd Möllmann
2022-10-05 12:59                     ` Eli Zaretskii
2022-10-06  5:35 ` Gerd Möllmann
2022-10-06  6:59   ` Eli Zaretskii
2022-10-06  7:21     ` Gerd Möllmann
2022-10-06  8:08       ` Eli Zaretskii
2022-10-06  8:23         ` Gerd Möllmann

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=jwvjzxjnd1y.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=58042@debbugs.gnu.org \
    --cc=alan@idiocy.org \
    --cc=eliz@gnu.org \
    --cc=gerd.moellmann@gmail.com \
    --cc=luangruo@yahoo.com \
    --cc=monnier@iro.umontreal.ca \
    /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).