linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <kees@outflux.net>
To: Wolfram Gloger <wg@malloc.de>
Cc: dvyukov@google.com, ak@linux.intel.com,
	linux-kernel@vger.kernel.org, pjt@google.com,
	andreyknvl@google.com, kcc@google.com, x86@kernel.org
Subject: Re: Out-of-bounds access in get_wchan (arch/x86/kernel/process_64.c)
Date: Sat, 28 Sep 2013 14:01:11 -0700	[thread overview]
Message-ID: <20130928210111.GZ21253@outflux.net> (raw)
In-Reply-To: <u4zjqwg1xp.fsf@mail.malloc.de>

On Sat, Sep 28, 2013 at 09:51:14PM +0200, Wolfram Gloger wrote:
> Kees Cook <kees@outflux.net> writes:
> 
> > 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.
> 
> I can't see the end boundary problem in process_32.c.  The end checks
> are properly reduced with the top_esp and top_ebp macros.
> 
> All I can see in process_32.c is that the check
> 
> 		if (bp < stack_page || bp > top_ebp+stack_page)
> 
> could be replaced by:
> 
> 		if (bp < stack_page-sizeof(unsigned long) || bp > top_ebp+stack_page)
> 
> but that is a relaxation and not an over/underrun fix.
> 
> Can you elaborate what problem you see in process_32.c?

Ah, yes, sorry, this appears to only be a problem in process_64.c. I didn't look
closely enough. I see now that top_esp and top_ebp correctly reduce the size of
THREAD_SIZE. Thanks!

-Kees

-- 
Kees Cook                                            @outflux.net

      reply	other threads:[~2013-09-28 21:01 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
2013-09-28 19:51       ` Wolfram Gloger
2013-09-28 21:01         ` Kees Cook [this message]

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=20130928210111.GZ21253@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).