[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f1cd3105-2d36-a699-ed4c-e293d26b828d@iki.fi>
Date: Thu, 31 Jan 2019 08:03:54 +0200
From: Pekka Enberg <penberg@....fi>
To: Matthew Wilcox <willy@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Rik van Riel <riel@...riel.com>,
Christoph Lameter <cl@...ux.com>,
Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
kernel-hardening@...ts.openwall.com,
Kees Cook <keescook@...omium.org>,
Michael Ellerman <mpe@...erman.id.au>
Subject: Re: [PATCH] mm: Prevent mapping slab pages to userspace
On 25/01/2019 19.38, Matthew Wilcox wrote:
> 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@...radead.org>
Acked-by: Pekka Enberg <penberg@...nel.org>
A WARN_ON_ONCE() would be nice here to let those buggy drivers know that
they will no longer work.
> ---
> 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);
>
Powered by blists - more mailing lists