|
Message-ID: <CAGXu5jJ=yHXC_S_o6V4QQ+DCV4w2T-tw_BiUXDAW2a8rZDhZJg@mail.gmail.com> Date: Sat, 26 Jan 2019 07:44:40 +1300 From: Kees Cook <keescook@...omium.org> To: Matthew Wilcox <willy@...radead.org> Cc: Andrew Morton <akpm@...ux-foundation.org>, Linux-MM <linux-mm@...ck.org>, LKML <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 <kernel-hardening@...ts.openwall.com>, Michael Ellerman <mpe@...erman.id.au> Subject: Re: [PATCH] mm: Prevent mapping slab pages to userspace On Sat, Jan 26, 2019 at 6:38 AM Matthew Wilcox <willy@...radead.org> 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> > --- > 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)) Are there other types that should not get mapped? (Or better yet, is there a whitelist of those that are okay to be mapped?) Either way, this sounds good. :) Reviewed-by: Kees Cook <keescook@...omium.org> -Kees > goto out; > retval = -ENOMEM; > flush_dcache_page(page); > -- > 2.20.1 > -- Kees Cook
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.