lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5j+8sxc8vc4bwv14nGNiOhq-ey2nxAK99LgMKO+Qmh1L6A@mail.gmail.com>
Date:	Thu, 3 Oct 2013 11:03:07 -0700
From:	Kees Cook <keescook@...omium.org>
To:	Al Viro <viro@...iv.linux.org.uk>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
	Dmitry Vyukov <dvyukov@...gle.com>
Subject: Re: [PATCH] fs: make sure we do not read beyond allocation

On Thu, Oct 3, 2013 at 10:58 AM, Al Viro <viro@...iv.linux.org.uk> wrote:
> 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...

Well, this is simply taking advantage of this particular allocator's
behavior. Instead of depending on this side-effect, why not change the
allocation so that we never risk a potentially broken read? (Even SLOB
notes that it may have as low as 2-byte granularity.)

-Kees

-- 
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ