Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110718192454.GA4489@albatros>
Date: Mon, 18 Jul 2011 23:24:54 +0400
From: Vasiliy Kulikov <segoon@...nwall.com>
To: Matt Mackall <mpm@...enic.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
	kernel-hardening@...ts.openwall.com,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>, "H. Peter Anvin" <hpa@...or.com>,
	x86@...nel.org, Arnd Bergmann <arnd@...db.de>,
	Christoph Lameter <cl@...ux-foundation.org>,
	Pekka Enberg <penberg@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
	linux-mm@...ck.org
Subject: Re: [RFC v2] implement SL*B and stack usercopy runtime checks

On Mon, Jul 18, 2011 at 14:08 -0500, Matt Mackall wrote:
> On Mon, 2011-07-18 at 22:39 +0400, Vasiliy Kulikov wrote:
> > This patch implements 2 additional checks for the data copied from
> > kernelspace to userspace and vice versa (original PAX_USERCOPY from PaX
> > patch).  Currently there are some very simple and cheap comparisons of
> > supplied size and the size of a copied object known at the compile time
> > in copy_* functions.  This patch enhances these checks to check against
> > stack frame boundaries and against SL*B object sizes.
> > 
> > More precisely, it checks:
> > 
> > 1) if the data touches the stack, checks whether it fully fits in the stack
> > and whether it fully fits in a single stack frame.  The latter is arch
> > dependent, currently it is implemented for x86 with CONFIG_FRAME_POINTER=y
> > only.  It limits infoleaks/overwrites to a single frame and local variables
> > only, and prevents saved return instruction pointer overwriting.
> > 
> > 2) if the data is from the SL*B cache, checks whether it fully fits in a
> > slab page and whether it overflows a slab object.  E.g. if the memory
> > was allocated as kmalloc(64, GFP_KERNEL) and one tries to copy 150
> > bytes, the copy would fail.
> 
> FYI, this should almost certainly be split into (at least) two patches:
> 
> - the stack check
> - the SL*B check (probably one patch per allocator, preceded by one for
> any shared infrastructure)

Sure, also per architecture probably.  But I want to get the comments
about the feature itself before the division.

Thanks,

-- 
Vasiliy Kulikov
http://www.openwall.com - bringing security into open computing environments

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.