all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Pip Cet via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: "Gerd Möllmann" <gerd.moellmann@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, telegraph@gmx.net, 75459@debbugs.gnu.org
Subject: bug#75459: 31.0.50; scratch-igc: Breakpoint 1, terminate_due_to_signal (sig=sig@entry=6, backtrace_limit=backtrace_limit@entry=2147483647) at ./src/emacs.c:432
Date: Fri, 10 Jan 2025 13:46:40 +0000	[thread overview]
Message-ID: <87ldvi3hok.fsf@protonmail.com> (raw)
In-Reply-To: <m2tta7xh2m.fsf@gmail.com>

Gerd Möllmann <gerd.moellmann@gmail.com> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>> The xbacktrace command is automatically called by GDB as a post-hook
>> of the "bt" (backtrace) command.  So when the functions called by GDB
>> to generate the Lisp backtrace crash, you see more calls to
>> terminate_due_to_signal, which again hit the above breakpoint.
>
> Ah, that explains it, thanks! Didn't know about that hook.

That explains why "backtrace" doesn't show up; it doesn't explain why
backtrace_function asserts on data that we previously ensured would be of
the right kind.

As the stack pointer is nowhere near the data that was clobbered, I have
no idea what's going on here.  .gdbinit ensures we're looking at a frame
with pdl->kind == SPECPDL_BACKTRACE, we call backtrace_function, which
is meant to be backtrace_function_body, which easserts the very same
thing we just tested, but finds it is no longer true.

Maybe backtrace_function is no longer equal to backtrace_function_body,
but backtrace_function should be in the .rodata section, which should be
protected against modification (but GDB has no problem modifying it, and
doesn't even issue a warning when doing so; another GDB bug, IMHO).

> Could the problem then perhaps be barriers? In emacs_lldb.py I have, for

I don't think so: barriers don't cause SIGABRT (not even when the
"barrier" is unknown and MPS gives up; in that case, MPS restores the
SIGSEGV handler and raises SIGSEGV again; I think that's an MPS bug,
BTW: what MPS should do is to restore the SIGSEGV handler and return
from the handler, which will cause the faulting instruction to be
re-executed, which will, in turn, call the original SIGSEGV handler with
a siginfo structure), and the eassert in backtrace_function accesses the
specpdl, which is (unfortunately) an unprotected root.

> LLDB, a command
>
>   def xpostmortem(debugger, command, ctx, result, internal_dict):
>       """Call igc_postmortem to set MPS arena to postmortem state"""
>       debugger.HandleCommand(f"expr igc_postmortem()")
>
> I call that command manually when MPS gets in the way. Here is the

Does lldb allow you to inspect memory that is behind a barrier?

GDB does (which is good), but doesn't warn about it in any way.  That is
very, very confusing behavior.  I think it qualifies as a GDB bug which
should be fixed (but the last GDB bug I reported was a +1 on a
20-year-old bug report that was never responded to in any way, so maybe
reporting further GDB bugs is a waste of time).

I don't think the decision to abort MPS and access the data in whatever
(presumably inconsistent) state it was left in is one that should be
made automatically, and that applies both to calling Emacs functions and
to using GDB commands.

If calling backtrace in GDB means we can't continue afterwards, that
would be very bad.  I think it's already bad that we automatically
append the Lisp backtrace to "bt" output.  IMHO, "bt" should limit
itself to accessing process memory via PTRACE, not call into application
code.  Making it destroy the Emacs session even when we can get a
backtrace would be worse.

Pip






  parent reply	other threads:[~2025-01-10 13:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-09 11:19 bug#75459: 31.0.50; scratch-igc: Breakpoint 1, terminate_due_to_signal (sig=sig@entry=6, backtrace_limit=backtrace_limit@entry=2147483647) at ./src/emacs.c:432 Gregor Zattler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-09 13:03 ` Eli Zaretskii
2025-01-09 14:34   ` Gerd Möllmann
2025-01-09 14:47     ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-09 15:32       ` Gregor Zattler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-09 16:14         ` Gerd Möllmann
2025-01-09 19:27           ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-09 22:29             ` Gregor Zattler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-10 13:59               ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-10  4:52             ` Gerd Möllmann
2025-01-10  7:15               ` Eli Zaretskii
2025-01-10  7:29                 ` Gerd Möllmann
2025-01-10  7:53                   ` Eli Zaretskii
2025-01-10  8:14                     ` Gerd Möllmann
2025-01-10 13:46                   ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2025-01-10 14:27                     ` Gerd Möllmann
2025-01-10 14:46                       ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-10 15:27                         ` Gerd Möllmann
2025-01-10 14:44                     ` Eli Zaretskii
2025-01-10 15:30                       ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-10 18:56                         ` Eli Zaretskii
2025-01-09 14:52     ` 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=87ldvi3hok.fsf@protonmail.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=75459@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=gerd.moellmann@gmail.com \
    --cc=pipcet@protonmail.com \
    --cc=telegraph@gmx.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.