public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/29046] New: RISC-V: call fails with non-executable stack
@ 2022-04-11 15:13 craig.blackmore at embecosm dot com
  2022-04-12 16:43 ` [Bug tdep/29046] " tromey at sourceware dot org
  0 siblings, 1 reply; 2+ messages in thread
From: craig.blackmore at embecosm dot com @ 2022-04-11 15:13 UTC (permalink / raw)
  To: gdb-prs

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

            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 <function>` on an inferior with a non-executable stack fails
because GDB sets the return address of `<function>` to a location on the stack
on which a breakpoint is set. When <function> 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 cause
issues for multi-thread targets
https://sourceware.org/bugzilla/show_bug.cgi?id=10944#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).

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

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

* [Bug tdep/29046] RISC-V: call fails with non-executable stack
  2022-04-11 15:13 [Bug gdb/29046] New: RISC-V: call fails with non-executable stack craig.blackmore at embecosm dot com
@ 2022-04-12 16:43 ` tromey at sourceware dot org
  0 siblings, 0 replies; 2+ messages in thread
From: tromey at sourceware dot org @ 2022-04-12 16:43 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org
          Component|gdb                         |tdep

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

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

end of thread, other threads:[~2022-04-12 16:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-11 15:13 [Bug gdb/29046] New: RISC-V: call fails with non-executable stack craig.blackmore at embecosm dot com
2022-04-12 16:43 ` [Bug tdep/29046] " tromey at sourceware dot org

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