lkml.org 
[lkml]   [2013]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Out-of-bounds access in get_wchan (arch/x86/kernel/process_64.c)
On Wed, Sep 11, 2013 at 10:16:32PM +0400, Dmitry Vyukov wrote:
> On Wed, Sep 11, 2013 at 2:06 AM, Andi Kleen <ak@linux.intel.com> wrote:
> >> Indeed, get_wchan ensures that fp<stack+THREAD_SIZE, but then dereferences fp+8:
> >>
> >> 434 if (fp < (unsigned long)stack ||
> >> 435 fp >= (unsigned long)stack+THREAD_SIZE)
> >> 436 return 0;
> >> 437 ip = *(u64 *)(fp+8);
> >>
> >> It must check that fp+8<stack+THREAD_SIZE.
> >> As far as I see, the bug can lead to garbage return values or in the
> >> worst case to crash.
> >
> > Thanks for the report.
> >
> > The change looks good to me. Can you please submit a formal signed off patch
> > to x86@kernel.org ?

Can you CC this to lkml as well? x86@ isn't a public list, IIUC.

Please note that these bounds checks aren't correct to begin with. Since
a pointer is being dereferenced, the end boundry must be reduced by
sizeof(unsigned long) as well.

It looks like process_32.c suffers the same problems, too.

-Kees

--
Kees Cook @outflux.net


\
 
 \ /
  Last update: 2013-09-27 21:41    [W:0.068 / U:1.732 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site