From: Al Viro <viro@ZenIV.linux.org.uk>
To: Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Dmitry Vyukov <dvyukov@google.com>
Subject: Re: [PATCH] fs: make sure we do not read beyond allocation
Date: Thu, 3 Oct 2013 18:58:24 +0100 [thread overview]
Message-ID: <20131003175824.GH13318@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20131003163411.GA17101@www.outflux.net>
On Thu, Oct 03, 2013 at 09:34:11AM -0700, Kees Cook wrote:
> In dentry_string_cmp (via__d_lookup_rcu), when CONFIG_DCACHE_WORD_ACCESS
> is set, word-width memory reads are performed. However, the string
> allocation size may not be a multiple of the word size. To avoid reading
> past the end of such an allocation, we must allocate in multiples of
> the word size.
grep ^kmalloc /proc/slabinfo. Observe the suffix after "kmalloc-"...
IOW, kmalloc() does round its argument up. Seeing that we allocate an
external name only when allocation has to be longer than 32 bytes, the
sucker is guaranteed to be at least a multiple of 32 by the time we
pick the fitting cache (the worst case is when length is between 65
and 96; then we use kmalloc-96).
When you start a port to a 512-bit architecture, you'll have much nastier
problems than this one...
next prev parent reply other threads:[~2013-10-03 17:58 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-03 16:34 [PATCH] fs: make sure we do not read beyond allocation Kees Cook
2013-10-03 17:58 ` Al Viro [this message]
2013-10-03 18:03 ` Kees Cook
2013-10-03 18:23 ` Al Viro
2013-10-03 19:36 ` Kees Cook
2013-10-03 20:57 ` Al Viro
2013-10-03 21:30 ` Kees Cook
2013-10-04 6:05 ` Dmitry Vyukov
2013-10-04 10:38 ` Richard Weinberger
2013-10-04 10:53 ` Dmitry Vyukov
2013-10-04 13:53 ` Richard Weinberger
2013-10-11 11:26 ` Dmitry Vyukov
2013-10-11 11:27 ` Dmitry Vyukov
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=20131003175824.GH13318@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=dvyukov@google.com \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.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).