Re: [RFC v2] implement SL*B and stack usercopy runtime checks
From: Matt Mackall
Date: Mon Jul 18 2011 - 15:08:31 EST
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)
Mathematics is the supreme nostalgia of our time.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/