Message ID | 1503956111-36652-26-git-send-email-keescook@chromium.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, 2017-08-28 at 14:35 -0700, Kees Cook wrote: > From: David Windsor <dave@nullcore.net> > > In support of usercopy hardening, this patch defines a region in the > thread_stack slab caches in which userspace copy operations are > allowed. > Since the entire thread_stack needs to be available to userspace, the > entire slab contents are whitelisted. Note that the slab-based thread > stack is only present on systems with THREAD_SIZE < PAGE_SIZE and > !CONFIG_VMAP_STACK. > Acked-by: Rik van Riel <riel@redhat.com>
diff --git a/kernel/fork.c b/kernel/fork.c index d8ebf755a47b..0f33fb1aabbf 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -276,8 +276,9 @@ static void free_thread_stack(struct task_struct *tsk) void thread_stack_cache_init(void) { - thread_stack_cache = kmem_cache_create("thread_stack", THREAD_SIZE, - THREAD_SIZE, 0, NULL); + thread_stack_cache = kmem_cache_create_usercopy("thread_stack", + THREAD_SIZE, THREAD_SIZE, 0, 0, + THREAD_SIZE, NULL); BUG_ON(thread_stack_cache == NULL); } # endif