lkml.org 
[lkml]   [2011]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC v2] implement SL*B and stack usercopy runtime checks
From
Date
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.




\
 
 \ /
  Last update: 2011-07-18 21:11    [W:0.189 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site