From: Kevin Buettner <kevinb@redhat.com>
To: Ronald Hecht <ronald.hecht@gmx.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v3] gdb: z80: Fix endless loop in frame unwinder and validate saved register types
Date: Sat, 20 Jun 2026 13:11:32 -0700 [thread overview]
Message-ID: <20260620130931.4004215f@f44-mesa-1> (raw)
In-Reply-To: <20260615070401.8671-1-ronald.hecht@gmx.de>
Hi Ronald,
This looks great! Thanks for making the changes I requested.
On Mon, 15 Jun 2026 09:04:01 +0200
Ronald Hecht <ronald.hecht@gmx.de> wrote:
> In z80_frame_unwind_cache, the loop scanning for the frame base pointer
> (for (;; ++sp)) could run into an endless loop or scan too far if the
> termination condition (sp < this_base) was not met due to corrupted
> or unexpected stack layouts. This patch introduces a loop_count to
> limit the scan to a maximum of 2 * addr_len iterations.
>
> Additionally, when iterating through saved registers to adjust their
> offsets into concrete addresses, the code now explicitly checks if
> the register actually holds an address using is_addr() before calling
> addr(). This prevents potential assertions or undefined behavior for
> registers that do not contain valid address data.
>
> gdb/ChangeLog:
>
> * z80-tdep.c (z80_frame_unwind_cache): Limit stack scanning
> to 2 * addr_len iterations to prevent endless loops. Check
> is_addr() before adjusting saved register addresses.
The ChangeLog entry isn't required, but there's no harm in having it in
the commit log. Regardless, don't add it to any ChangeLog files prior
to pushing it.
Approved-By: Kevin Buettner <kevinb@redhat.com>
next prev parent reply other threads:[~2026-06-20 20:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-05 18:56 [PATCH] gdb: z80: Fix endless backtrace loop and assertion crashes Ronald Hecht
2026-06-06 19:40 ` Kevin Buettner
2026-06-07 7:36 ` Ronald Hecht
2026-06-07 7:48 ` [PATCH v2] " Ronald Hecht
2026-06-14 22:06 ` Kevin Buettner
2026-06-15 6:49 ` Ronald Hecht
2026-06-15 7:04 ` [PATCH v3] gdb: z80: Fix endless loop in frame unwinder and validate saved register types Ronald Hecht
2026-06-20 20:11 ` Kevin Buettner [this message]
2026-06-23 7:16 ` Ronald Hecht
2026-07-09 3:52 ` Kevin Buettner
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=20260620130931.4004215f@f44-mesa-1 \
--to=kevinb@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=ronald.hecht@gmx.de \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox