lkml.org 
[lkml]   [2015]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] x86, stackvalidate: Compile-time stack frame pointer validation
On Tue, Apr 28, 2015 at 02:16:06PM +0200, Peter Zijlstra wrote:
> On Mon, Apr 27, 2015 at 08:56:27AM -0500, Josh Poimboeuf wrote:
> > Frame pointer based stack traces aren't always reliable. One big reason
> > is that most asm functions don't set up the frame pointer.
> >
> > Fix that by enforcing that all asm functions honor CONFIG_FRAME_POINTER.
> > This is done with a new stackvalidate host tool which is automatically
> > run for every compiled .S file and which validates that every asm
> > function does the proper frame pointer setup.
>
> Would it make sense (maybe as an additional CONFIG_*_DEBUG thing) to
> also process the output of GCC with this tool? To both double check GCC
> and to give the tool more input?

I tried that, but I discovered that gcc's usage of frame pointers would
be a lot harder to validate. It only sets up the frame pointer in code
paths which have call instructions. There are a lot of functions which
have conditional jumps at the beginning which can jump straight to a
return instruction without first doing the frame pointer setup.

So it would really need to have a much more sophisticated static code
analysis. But I think the possibility of gcc messing up frame pointers
is very slim. I doubt it would be worth the complexity (and added
compile time) needed to try to find any gcc bugs there.

--
Josh


\
 
 \ /
  Last update: 2015-04-28 16:41    [W:0.066 / U:2.820 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site