From: Josh Poimboeuf <jpoimboe@redhat.com>
To: David Laight <David.Laight@aculab.com>
Cc: "vanessa.hack@fau.de" <vanessa.hack@fau.de>,
"peterz@infradead.org" <peterz@infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: objtool/ORC generation for noreturn functions
Date: Wed, 13 Jan 2021 16:45:26 -0600 [thread overview]
Message-ID: <20210113224526.64d244e7a4szftpj@treble> (raw)
In-Reply-To: <8bfda75985c4429297afce9340303e34@AcuMS.aculab.com>
On Wed, Jan 13, 2021 at 10:39:53PM +0000, David Laight wrote:
> > On Wed, Jan 13, 2021 at 11:44:22AM +0100, vanessa.hack@fau.de wrote:
> > > Hi,
> > > I am currently writing my final thesis at university on the topic of stack
> > > unwinding. My goal is to implement and evaluate stack unwinders for
> > > research operating system ports to x86 32 and 64 bit architectures and
> > > SPARC V8.
> > > For the x86 ports I chose ORC as unwinding format due to its simplicity
> > > and reliability. So far, it works quite well (although I've ran into some
> > > minor issues with objtool as the research OS is written in C++).
> > > But now I have some problems with functions that are explicitly marked as
> > > noreturn with the [[noreturn]] attribute, all following unwinding steps
> > > are unreliable. I have read in the objtool documentation that such
> > > functions have to be added to the objtool global_noreturn array.
> > > Unfortunately, I do not understand the purpose of that array and the
> > > intended ORC behaviour for noreturn functions. Are the unwinding steps
> > > that follow a noreturn intended to be unreliable?
>
> There was an 'interesting' unwinder I saw a few years ago.
> (Which couldn't handle 'noreturn' functions.)
>
> The idea is to follow forwards through the code while keeping
> track of %sp and %fp until a return instruction is found.
> You need to be able to detect loops, and then continue from
> the other target of an earlier conditional branch.
> Provided function calls don't change %sp they can be ignored.
> If the %fp isn't used as a frame pointer it won't get reloaded
> into %sp so it doesn't matter
>
> This works (most of the time) with no debug info and no symbol
> table.
Almost sounds like an in-kernel version of objtool :-)
--
Josh
next prev parent reply other threads:[~2021-01-14 1:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <daf04159-a458-4f0d-9f29-d8ef5a63fae6@email.android.com>
2021-01-13 18:41 ` Josh Poimboeuf
2021-01-13 22:39 ` David Laight
2021-01-13 22:45 ` Josh Poimboeuf [this message]
2021-01-14 19:35 ` Hack, Vanessa
2021-01-14 19:47 ` Josh Poimboeuf
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=20210113224526.64d244e7a4szftpj@treble \
--to=jpoimboe@redhat.com \
--cc=David.Laight@aculab.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=vanessa.hack@fau.de \
/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
all inboxes | Powered by JetHome®