Messages in this thread | | | Date | Wed, 13 Jan 2021 16:45:26 -0600 | From | Josh Poimboeuf <> | Subject | Re: objtool/ORC generation for noreturn functions |
| |
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
| |