From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C1A513854DA5; Mon, 11 Apr 2022 15:13:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C1A513854DA5 From: "craig.blackmore at embecosm dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/29046] New: RISC-V: call fails with non-executable stack Date: Mon, 11 Apr 2022 15:13:13 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: craig.blackmore at embecosm 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: Mon, 11 Apr 2022 15:13:13 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29046 Bug ID: 29046 Summary: RISC-V: call fails with non-executable stack Product: gdb Version: HEAD Status: UNCONFIRMED Severity: normal Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: craig.blackmore at embecosm dot com Target Milestone: --- Doing `call ` on an inferior with a non-executable stack fails because GDB sets the return address of `` to a location on the st= ack on which a breakpoint is set. When returns, jumping to this stack location triggers an instruction access exception. I suspect other targets = may also have a similar issue. I have three ideas for making this work: 1. Make `gdbarch_call_dummy_location` configurable so that `AT_ENTRY_POINT` could be used optionally instead of `ON_STACK`, however, this may still cau= se issues for multi-thread targets https://sourceware.org/bugzilla/show_bug.cgi?id=3D10944#c6. 2. Reinstate `AT_SYMBOL` (removed in `2efbc0f7220afb483293e101e25bf2e93bce0787`), so that unlike `AT_ENTRY_POINT` the return address could be somewhere that no other thread is expected to be executing. 3. According to the RISC-V priv spec 20190608, hardware breakpoints have a higher priority than instruction access faults. In the RISC-V backend, optionally use a hardware breakpoint on the stack location. The drawback is that there needs to be a hardware breakpoint available unlike option 2 (and option 1 if the entry point is in writable memory). --=20 You are receiving this mail because: You are on the CC list for the bug.=