[lkml]   [2016]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v2 01/11] mm: Implement stack frame object validation
On Wed, Jul 13, 2016 at 03:04:26PM -0700, Kees Cook wrote:
> On Wed, Jul 13, 2016 at 3:01 PM, Andy Lutomirski <> wrote:
> > On Wed, Jul 13, 2016 at 2:55 PM, Kees Cook <> wrote:
> >> This creates per-architecture function arch_within_stack_frames() that
> >> should validate if a given object is contained by a kernel stack frame.
> >> Initial implementation is on x86.
> >>
> >> This is based on code from PaX.
> >>
> >
> > This, along with Josh's livepatch work, are two examples of unwinders
> > that matter for correctness instead of just debugging. ISTM this
> > should just use Josh's code directly once it's been written.
> Do you have URL for Josh's code? I'd love to see what happening there.

The code is actually going to be 100% different next time around, but
FWIW, here's the last attempt:

In the meantime I've realized the need to rewrite the x86 core stack
walking code to something much more manageable so we don't need all
these unwinders everywhere. I'll probably post the patches in the next
week or so. I'll add you to the CC list.

With the new interface I think you'll be able to do something like:

struct unwind_state;

unwind_start(&state, current, NULL, NULL);
oldframe = unwind_get_stack_pointer(&state);

frame = unwind_get_stack_pointer(&state);

do {
if (obj + len <= frame)
return blah;
oldframe = frame;
frame = unwind_get_stack_pointer(&state);

} while (unwind_next_frame(&state);

And then at the end there'll be some (still TBD) way to query whether it
reached the last syscall pt_regs frame, or if it instead encountered a
bogus frame pointer along the way and had to bail early.


 \ /
  Last update: 2016-07-14 08:21    [W:0.058 / U:1.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site