public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug tdep/28796] New: GDB locks up after stopping on a breakpoint in invalidated memory on aarch64
@ 2022-01-20  9:41 idan.horowitz at gmail dot com
  2022-01-20  9:44 ` [Bug tdep/28796] " idan.horowitz at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: idan.horowitz at gmail dot com @ 2022-01-20  9:41 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28796

            Bug ID: 28796
           Summary: GDB locks up after stopping on a breakpoint in
                    invalidated memory on aarch64
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tdep
          Assignee: unassigned at sourceware dot org
          Reporter: idan.horowitz at gmail dot com
  Target Milestone: ---

When debugging a kernel inside QEMU aarch64-softmmu using GDB for
aarch64-none-linux-gnu, when GDB pauses execution after a breakpoint is hit in
invalidated memory (that is, memory that does not have a valid translation
yet), GDB locks up.
Meaning that execution can not be resumed again (using stepi/continue/advance
etc), this is due to the fact that GDB tries to read the memory at the current
PC when resuming execution, which it fails to do due to the invalid
translation, but this also stops it from stepping into the translation
exception handler, essentially locking up GDB completely.
I've tracked down said memory read to the following call:
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/aarch64-tdep.c;h=63d626f90ace55f80c5d3e3d557993d905a90da1;hb=HEAD#l2869
This read is used to detect and execute load-exclusive/store-exclusive
sequences atomically, but the issue is the fact that this method uses the
unsafe read_memory_unsigned_integer method, which throws when a read fails,
instead of calling safe_read_memory_unsigned_integer and returning an empty
vector like the rest of the failure paths in this method do. This exception
then bubbles up to `resume_1` which cancels the resumption of the execution,
locking GDB in place.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tdep/28796] GDB locks up after stopping on a breakpoint in invalidated memory on aarch64
  2022-01-20  9:41 [Bug tdep/28796] New: GDB locks up after stopping on a breakpoint in invalidated memory on aarch64 idan.horowitz at gmail dot com
@ 2022-01-20  9:44 ` idan.horowitz at gmail dot com
  2022-10-21 10:11 ` luis.machado at arm dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: idan.horowitz at gmail dot com @ 2022-01-20  9:44 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28796

Idan Horowitz <idan.horowitz at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |aarch64-none-linux-gnu

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tdep/28796] GDB locks up after stopping on a breakpoint in invalidated memory on aarch64
  2022-01-20  9:41 [Bug tdep/28796] New: GDB locks up after stopping on a breakpoint in invalidated memory on aarch64 idan.horowitz at gmail dot com
  2022-01-20  9:44 ` [Bug tdep/28796] " idan.horowitz at gmail dot com
@ 2022-10-21 10:11 ` luis.machado at arm dot com
  2022-10-21 10:11 ` luis.machado at arm dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: luis.machado at arm dot com @ 2022-10-21 10:11 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28796

Luis Machado <luis.machado at arm dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |luis.machado at arm dot com
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2022-10-21

--- Comment #1 from Luis Machado <luis.machado at arm dot com> ---
Thanks for reporting this. Sorry for the late reply.

I'll take a look at it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tdep/28796] GDB locks up after stopping on a breakpoint in invalidated memory on aarch64
  2022-01-20  9:41 [Bug tdep/28796] New: GDB locks up after stopping on a breakpoint in invalidated memory on aarch64 idan.horowitz at gmail dot com
  2022-01-20  9:44 ` [Bug tdep/28796] " idan.horowitz at gmail dot com
  2022-10-21 10:11 ` luis.machado at arm dot com
@ 2022-10-21 10:11 ` luis.machado at arm dot com
  2022-11-10  0:45 ` cvs-commit at gcc dot gnu.org
  2022-11-10  0:46 ` luis.machado at arm dot com
  4 siblings, 0 replies; 6+ messages in thread
From: luis.machado at arm dot com @ 2022-10-21 10:11 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28796

Luis Machado <luis.machado at arm dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |luis.machado at arm dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tdep/28796] GDB locks up after stopping on a breakpoint in invalidated memory on aarch64
  2022-01-20  9:41 [Bug tdep/28796] New: GDB locks up after stopping on a breakpoint in invalidated memory on aarch64 idan.horowitz at gmail dot com
                   ` (2 preceding siblings ...)
  2022-10-21 10:11 ` luis.machado at arm dot com
@ 2022-11-10  0:45 ` cvs-commit at gcc dot gnu.org
  2022-11-10  0:46 ` luis.machado at arm dot com
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-10  0:45 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28796

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Luis Machado <luisgpm@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=94355de7751579b0182bd5821a3223939054f5d7

commit 94355de7751579b0182bd5821a3223939054f5d7
Author: Luis Machado <luis.machado@arm.com>
Date:   Mon Oct 31 13:26:20 2022 +0000

    [gdb/aarch64] Use safer memory read routines

      PR tdep/28796

      As reported, we are using some memory read routines that don't handle
read
      errors gracefully. Convert those to use the safe_* versions if available.

      This allows the code to handle those read errors in a more sensible way.

      Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28796

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tdep/28796] GDB locks up after stopping on a breakpoint in invalidated memory on aarch64
  2022-01-20  9:41 [Bug tdep/28796] New: GDB locks up after stopping on a breakpoint in invalidated memory on aarch64 idan.horowitz at gmail dot com
                   ` (3 preceding siblings ...)
  2022-11-10  0:45 ` cvs-commit at gcc dot gnu.org
@ 2022-11-10  0:46 ` luis.machado at arm dot com
  4 siblings, 0 replies; 6+ messages in thread
From: luis.machado at arm dot com @ 2022-11-10  0:46 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28796

Luis Machado <luis.machado at arm dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Luis Machado <luis.machado at arm dot com> ---
Fixed. Please reopen if you see any issues.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-11-10  0:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-20  9:41 [Bug tdep/28796] New: GDB locks up after stopping on a breakpoint in invalidated memory on aarch64 idan.horowitz at gmail dot com
2022-01-20  9:44 ` [Bug tdep/28796] " idan.horowitz at gmail dot com
2022-10-21 10:11 ` luis.machado at arm dot com
2022-10-21 10:11 ` luis.machado at arm dot com
2022-11-10  0:45 ` cvs-commit at gcc dot gnu.org
2022-11-10  0:46 ` luis.machado at arm dot com

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).