From: Kees Cook <kees@outflux.net>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Andi Kleen <ak@linux.intel.com>, Wolfram Gloger <wg@malloc.de>,
LKML <linux-kernel@vger.kernel.org>, Paul Turner <pjt@google.com>,
Andrey Konovalov <andreyknvl@google.com>,
Kostya Serebryany <kcc@google.com>,
x86@kernel.org
Subject: Re: Out-of-bounds access in get_wchan (arch/x86/kernel/process_64.c)
Date: Fri, 27 Sep 2013 12:03:12 -0700 [thread overview]
Message-ID: <20130927190312.GV21253@outflux.net> (raw)
In-Reply-To: <CACT4Y+Y2-d0TFq=oq-xFt8udrYc0r8_aROdUfVU29KJBhwWpAQ@mail.gmail.com>
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
next prev parent reply other threads:[~2013-09-27 19:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-03 14:41 Out-of-bounds access in get_wchan (arch/x86/kernel/process_64.c) Dmitry Vyukov
2013-09-10 22:06 ` Andi Kleen
2013-09-11 18:16 ` Dmitry Vyukov
2013-09-27 19:03 ` Kees Cook [this message]
2013-09-28 19:51 ` Wolfram Gloger
2013-09-28 21:01 ` Kees Cook
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=20130927190312.GV21253@outflux.net \
--to=kees@outflux.net \
--cc=ak@linux.intel.com \
--cc=andreyknvl@google.com \
--cc=dvyukov@google.com \
--cc=kcc@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pjt@google.com \
--cc=wg@malloc.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.