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

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