lkml.org 
[lkml]   [2019]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] mm: Prevent mapping slab pages to userspace
Date
Matthew Wilcox <willy@infradead.org> writes:

> It's never appropriate to map a page allocated by SLAB into userspace.
> A buggy device driver might try this, or an attacker might be able to
> find a way to make it happen.
>
> Signed-off-by: Matthew Wilcox <willy@infradead.org>
> ---
> mm/memory.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index e11ca9dd823f..ce8c90b752be 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -1451,7 +1451,7 @@ static int insert_page(struct vm_area_struct *vma, unsigned long addr,
> spinlock_t *ptl;
>
> retval = -EINVAL;
> - if (PageAnon(page))
> + if (PageAnon(page) || PageSlab(page))
> goto out;
> retval = -ENOMEM;
> flush_dcache_page(page);


Thanks for turning this into an actual patch.

cheers

\
 
 \ /
  Last update: 2019-01-31 01:38    [W:0.115 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site