lkml.org 
[lkml]   [2015]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] arch/x86: fix out-of-bounds in get_wchan()
From
2015-09-28 12:00 GMT+03:00 Dmitry Vyukov <dvyukov@google.com>:
> stack = (unsigned long)task_stack_page(p);
> - if (p->thread.sp < stack || p->thread.sp >= stack+THREAD_SIZE)
> + /* The task can be already running at this point, so tread carefully. */
> + fp = READ_ONCE(p->thread.sp);
> + if (fp < stack || fp >= stack+THREAD_SIZE)

Since we deference fp, it should be "|| fp + sizeof(u64) >= stack + THREAD_SIZE"

> return 0;
> - fp = *(u64 *)(p->thread.sp);
> + fp = READ_ONCE(*(u64 *)fp);
> do {
> if (fp < (unsigned long)stack ||
> - fp >= (unsigned long)stack+THREAD_SIZE)
> + fp+8 >= (unsigned long)stack+THREAD_SIZE)

The same as above;
'fp+8 +sizeof(u64) >= ...'

> return 0;
> - ip = *(u64 *)(fp+8);
> + ip = READ_ONCE(*(u64 *)(fp+8));
>


\
 
 \ /
  Last update: 2015-09-28 18:01    [W:0.102 / U:0.636 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site