Re: [PATCH v2] lkdtm: Add tests for LIST_POISON and ZERO_SIZE_PTR

From: Greg KH
Date: Sat Dec 03 2016 - 04:11:20 EST


On Sat, Dec 03, 2016 at 10:10:57AM +0100, Greg KH wrote:
> On Fri, Dec 02, 2016 at 01:32:24PM -0800, Kees Cook wrote:
> > On Thu, Dec 1, 2016 at 8:22 PM, Michael Ellerman <mpe@xxxxxxxxxxxxxx> wrote:
> > > This adds two tests, to check that a read or write to LIST_POISON1 and
> > > ZERO_SIZE_PTR are blocked.
> > >
> > > The default values for both (256 and 16) typically fall in the range
> > > of valid user space addresses. However in general mmap_min_addr is 64K,
> > > which prevents user space from mapping anything at those addresses.
> > >
> > > However it's feasible that an attacker will be able to find a way to
> > > cause an access at an offset from either value, and if that offset is
> > > greater than 64K then they can access user space again.
> > >
> > > To simulate that case, in the test we create a user mapping at
> > > approximately mmap_min_addr, and offset the pointer by that amount. This
> > > gives the test the greatest chance of failing (ie. an access
> > > succeeding). We don't actually use mmap_min_addr, because that would
> > > require exporting it to modules, instead we use the default value at
> > > compile time as a reasonable approximation.
> > >
> > > Signed-off-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
> >
> > Thanks for this! I like it. :)
> >
> > Acked-by: Kees Cook <keescook@xxxxxxxxxxxx>
> >
> > Greg, can you take this into your tree?
>
> Sure, will do so on Monday.

Oops, no, I will not, kbuild reports build errors with it :(