From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 86C873858D37; Thu, 20 Jan 2022 09:41:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 86C873858D37 From: "idan.horowitz at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug tdep/28796] New: GDB locks up after stopping on a breakpoint in invalidated memory on aarch64 Date: Thu, 20 Jan 2022 09:41:52 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: tdep X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: idan.horowitz at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Jan 2022 09:41:52 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28796 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/advan= ce etc), this is due to the fact that GDB tries to read the memory at the curr= ent 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=3Dbinutils-gdb.git;a=3Dblob;f=3Dgdb/aarch64-t= dep.c;h=3D63d626f90ace55f80c5d3e3d557993d905a90da1;hb=3DHEAD#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. --=20 You are receiving this mail because: You are on the CC list for the bug.=