all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Pip Cet <pipcet@protonmail.com>
Cc: eller.helmut@gmail.com, gerd.moellmann@gmail.com,
	yantar92@posteo.net, emacs-devel@gnu.org
Subject: Re: MPS: a random backtrace while toying with gdb
Date: Wed, 03 Jul 2024 18:41:25 +0300	[thread overview]
Message-ID: <865xtmbhzu.fsf@gnu.org> (raw)
In-Reply-To: <mmX8KRhhXjl-FhfxTFnCPevO9u3drNXWTa8ropqiW5JwwqwsmuabgccUbgVSYH-PeTXrGXFblwTWqkF_Mc8C70GmIHHW8bPAbBCIcI9z0_k=@protonmail.com> (message from Pip Cet on Wed, 03 Jul 2024 14:35:16 +0000)

> Date: Wed, 03 Jul 2024 14:35:16 +0000
> From: Pip Cet <pipcet@protonmail.com>
> Cc: eller.helmut@gmail.com, gerd.moellmann@gmail.com, yantar92@posteo.net, emacs-devel@gnu.org
> 
> > I'd start with the first half of (1). It is not clear to me that the
> > other part is needed, and in any case we need a reproducer for it
> > first.
> 
> Ihor's original SIGPROF-based reproducer works if you revert the (SIGPROF-specific) workaround by Helmut. What makes you think it can't happen with other signals (which, naturally, aren't as frequent or badly-timed as SIGPROF, which strikes precisely when the CPU is active)?
> 
> Obviously a reproducer is highly desirable in this case, but we shouldn't leave known and understood bugs in the code.

I agree, but you yourself said, and I agree, that without a test case
we cannot test any fixes in that area.  So let's have the text case
first and analyze it, before discussing solution.

> > Most of the crashes we've seen until now were not when the MPS
> > handler was running. Also, didn't someone say that when the MPS
> 
> Ihor's first crash backlog (MPS: profiler) clearly shows that was the case: https://lists.gnu.org/archive/html/emacs-devel/2024-06/msg00568.html
> 
> > SIGSEGV handler is active, we could detect that from our code and
> > return doing nothing?
> 
> Dropping the signal in the process.

No, setting a flag to 'raise' the same signal when we are back in our
code and in safe environment (i.e., not called from the MPS SIGSEGV
handler).

Btw, an alternative would be to block the signals we care about while
in the MPS SIGSEGV handler in some way.  The way they install the
handler is very simple, see protsgix.c:ProtSetup.  Their code masks no
signals; we could instead mask the signals we care about.  As a POC,
I'd simply modify their code, but if that works, we could later
override their handler setup with ours or something.

> > Doing (2) adds a whole lot of complexity to Emacs.
> 
> You're right.
> 
> > Most importantly,
> > we will be unable to access Lisp data safely, unwind-protect and the
> > entire specpdl stuff generally cannot be used, and signaling an error
> > would be fatal. So I'd rather avoid that.
> 
> Very good points, though I wonder to what extent our current code is safe...

Well, I know from the MS-Windows experience that this is fraught with
pitfalls which took us some years to find and fix.  (On Windows, Emacs
uses additional threads for GUI I/O and for emulating SIGALRM and
SIGPROF.)



  reply	other threads:[~2024-07-03 15:41 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-29 19:12 MPS: a random backtrace while toying with gdb Ihor Radchenko
2024-06-29 19:19 ` Pip Cet
2024-06-29 21:46   ` Gerd Möllmann
2024-06-30  4:55     ` Eli Zaretskii
2024-06-30  5:33       ` Gerd Möllmann
2024-06-30  6:16         ` Eli Zaretskii
2024-06-30  6:43           ` Gerd Möllmann
2024-06-30  8:52             ` Eli Zaretskii
2024-06-30  9:43               ` Gerd Möllmann
2024-06-30 10:05                 ` Eli Zaretskii
2024-06-30 11:20                   ` Gerd Möllmann
2024-06-30 12:16                     ` Eli Zaretskii
2024-06-30 12:43                       ` Gerd Möllmann
2024-06-30  9:36     ` Helmut Eller
2024-06-30 10:00       ` Eli Zaretskii
2024-06-30 10:24         ` Helmut Eller
2024-06-30 10:43           ` Eli Zaretskii
2024-06-30 18:42             ` Helmut Eller
2024-06-30 18:59               ` Gerd Möllmann
2024-06-30 19:25               ` Pip Cet
2024-06-30 19:49                 ` Ihor Radchenko
2024-06-30 20:09                 ` Eli Zaretskii
2024-06-30 20:32                   ` Pip Cet
2024-07-01 11:07                     ` Eli Zaretskii
2024-07-01 17:27                       ` Pip Cet
2024-07-01 17:42                         ` Ihor Radchenko
2024-07-01 18:08                         ` Eli Zaretskii
2024-07-02  7:55                           ` Pip Cet
2024-07-02 13:10                             ` Eli Zaretskii
2024-07-02 14:24                               ` Pip Cet
2024-07-02 14:57                                 ` Eli Zaretskii
2024-07-02 17:06                                   ` Pip Cet
2024-07-03 11:31                                     ` Pip Cet
2024-07-03 11:50                                       ` Eli Zaretskii
2024-07-03 14:35                                         ` Pip Cet
2024-07-03 15:41                                           ` Eli Zaretskii [this message]
2024-07-01  2:33                 ` Eli Zaretskii
2024-07-01  6:05                 ` Helmut Eller
2024-06-30 19:58               ` Eli Zaretskii
2024-06-30 21:08                 ` Ihor Radchenko
2024-07-01  2:35                   ` Eli Zaretskii
2024-07-01 11:13                   ` Eli Zaretskii
2024-07-01 11:47                     ` Ihor Radchenko
2024-07-01 12:33                       ` Eli Zaretskii
2024-07-01 17:17                         ` Ihor Radchenko
2024-07-01 17:44                           ` Eli Zaretskii
2024-07-01 18:01                             ` Ihor Radchenko
2024-07-01 18:16                               ` Eli Zaretskii
2024-07-01 18:24                                 ` Ihor Radchenko
2024-07-01 18:31                                   ` Eli Zaretskii
2024-07-01 18:51                                     ` Ihor Radchenko
2024-07-01 19:05                                       ` Eli Zaretskii
2024-07-01 19:34                                       ` Gerd Möllmann
2024-07-01 20:00                                         ` Ihor Radchenko
2024-07-02  4:33                                           ` Gerd Möllmann
2024-07-02  7:05                                             ` Ihor Radchenko
2024-07-02  7:06                                               ` Gerd Möllmann
2024-07-01 18:19                               ` Gerd Möllmann
2024-07-01 18:23                                 ` Eli Zaretskii
2024-06-30 11:07           ` Gerd Möllmann
2024-06-30 11:06         ` Gerd Möllmann
2024-06-30 11:05       ` Gerd Möllmann
2024-06-30  9:59     ` Pip Cet
2024-06-30 10:09       ` Eli Zaretskii
2024-06-30 10:16         ` Pip Cet
2024-06-30 10:34           ` Eli Zaretskii
2024-06-30 13:06             ` Pip Cet
2024-06-30 11:10       ` 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=865xtmbhzu.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=eller.helmut@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=gerd.moellmann@gmail.com \
    --cc=pipcet@protonmail.com \
    --cc=yantar92@posteo.net \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.