From: Andrew Cagney <ac131313@redhat.com>
To: gdb@sources.redhat.com
Subject: dummy frame on stack and SPARC
Date: Wed, 05 Mar 2003 19:47:00 -0000 [thread overview]
Message-ID: <3E665442.2070007@redhat.com> (raw)
(thinking out loud)
The sparc architecture, when calling a struct return function has a
sequence like:
call struct_return_function, return address = pc + 8
nop
.word sizeof returned object
return_address:
... next instruction ....
That is, the return address is several instructions beyond the call
instruction and, more importantly, one of those "instructions" is an a
word to inform the callee of additional ABI information (from memory,
how much space the return structure needs).
When correctly implemeting sparc dummy calls, this behavior needs to be
implemented. Hence the call needs 2 words (the struct return size and
the breakpoint)instead of just one (the breakpoint) and the code dummy
no longer fits in _start. Conseqently, the SPARC, by default, pushes
the code dummy on the stack.
Problem is, this assumes that the target has an executable stack
(security?). As a consequence, the SPARC either:
- writes a two word code dummy onto the stack and correctly handls
struct return
- writes a one word code dummy into _start and fails when given a struct
return function
Instead of doing this, would it be possible to always write the code
dummy onto the stack and, when the stack isn't executable, recognize the
sigseg (?) as an attempt to return to the call dummy?
The only thing I'm not sure about is exactly when a SPARC will recognize
the segmentation violation and abort. It, thanks to the delayed branch
code, could be a cycle too early :-(
Andrew
reply other threads:[~2003-03-05 19:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3E665442.2070007@redhat.com \
--to=ac131313@redhat.com \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).