Commit 6d07d1cd authored by Kees Cook's avatar Kees Cook

usercopy: Restrict non-usercopy caches to size 0

With all known usercopied cache whitelists now defined in the
kernel, switch the default usercopy region of kmem_cache_create()
to size 0. Any new caches with usercopy regions will now need to use
kmem_cache_create_usercopy() instead of kmem_cache_create().

This patch is modified from Brad Spengler/PaX Team's PAX_USERCOPY
whitelisting code in the last public patch of grsecurity/PaX based on my
understanding of the code. Changes or omissions from the original code are
mine and don't reflect the original grsecurity/PaX code.

Cc: David Windsor <dave@nullcore.net>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
parent 51776043
...@@ -532,7 +532,7 @@ struct kmem_cache * ...@@ -532,7 +532,7 @@ struct kmem_cache *
kmem_cache_create(const char *name, size_t size, size_t align, kmem_cache_create(const char *name, size_t size, size_t align,
slab_flags_t flags, void (*ctor)(void *)) slab_flags_t flags, void (*ctor)(void *))
{ {
return kmem_cache_create_usercopy(name, size, align, flags, 0, size, return kmem_cache_create_usercopy(name, size, align, flags, 0, 0,
ctor); ctor);
} }
EXPORT_SYMBOL(kmem_cache_create); EXPORT_SYMBOL(kmem_cache_create);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment