Message ID | 1503956111-36652-25-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 > mm_struct slab caches in which userspace copy operations are allowed. > Only the auxv field is copied to userspace. > Acked-by: Rik van Riel <riel@redhat.com>
diff --git a/kernel/fork.c b/kernel/fork.c index 17921b0390b4..d8ebf755a47b 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -2206,9 +2206,11 @@ void __init proc_caches_init(void) * maximum number of CPU's we can ever have. The cpumask_allocation * is at the end of the structure, exactly for that reason. */ - mm_cachep = kmem_cache_create("mm_struct", + mm_cachep = kmem_cache_create_usercopy("mm_struct", sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN, SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_NOTRACK|SLAB_ACCOUNT, + offsetof(struct mm_struct, saved_auxv), + sizeof_field(struct mm_struct, saved_auxv), NULL); vm_area_cachep = KMEM_CACHE(vm_area_struct, SLAB_PANIC|SLAB_ACCOUNT); mmap_init();