From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Michal Marek <mmarek@suse.cz>,
x86@kernel.org, live-patching@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] x86, stackvalidate: Compile-time stack frame pointer validation
Date: Tue, 28 Apr 2015 09:21:05 -0500 [thread overview]
Message-ID: <20150428142105.GB17315@treble.redhat.com> (raw)
In-Reply-To: <20150428140842.GC23123@twins.programming.kicks-ass.net>
On Tue, Apr 28, 2015 at 04:08:42PM +0200, Peter Zijlstra wrote:
> On Tue, Apr 28, 2015 at 09:04:54AM -0500, Josh Poimboeuf wrote:
> > 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.
>
> Hmm, would not such code break your patching?
No, because we'll also do some runtime stack validation (which will be a
future patch set). If we detect preemption or an irq frame on the
stack, we'll assume the stack is unreliable and delay the patching of
the task (*). Otherwise the stack will only consist of calls down to
schedule() which will be guaranteed to have frame pointers.
(*) This can be even further improved by making _all_ stacks reliable if
we can ensure that dwarf call frame information is reliable (more
future patch sets).
--
Josh
next prev parent reply other threads:[~2015-04-28 14:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-27 13:56 [PATCH 0/2] " Josh Poimboeuf
2015-04-27 13:56 ` [PATCH 1/2] x86, stackvalidate: " Josh Poimboeuf
2015-04-28 12:16 ` Peter Zijlstra
2015-04-28 14:04 ` Josh Poimboeuf
2015-04-28 14:08 ` Peter Zijlstra
2015-04-28 14:21 ` Josh Poimboeuf [this message]
2015-04-28 14:26 ` Peter Zijlstra
2015-04-28 16:44 ` Petr Mladek
2015-04-28 17:54 ` Josh Poimboeuf
2015-04-27 13:56 ` [PATCH 2/2] x86, stackvalidate: Add asm frame pointer setup macros 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=20150428142105.GB17315@treble.redhat.com \
--to=jpoimboe@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mmarek@suse.cz \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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
Powered by JetHome