All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: Prevent mapping slab pages to userspace
@ 2019-01-25 17:38 Matthew Wilcox
  2019-01-25 18:44   ` Kees Cook
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Matthew Wilcox @ 2019-01-25 17:38 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Matthew Wilcox, linux-mm, linux-kernel, Rik van Riel,
	Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	kernel-hardening, Kees Cook, Michael Ellerman

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);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-01-31  6:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-25 17:38 [PATCH] mm: Prevent mapping slab pages to userspace Matthew Wilcox
2019-01-25 18:44 ` Kees Cook
2019-01-25 18:44   ` Kees Cook
2019-01-25 19:30   ` Matthew Wilcox
2019-01-28 18:20 ` Andrew Morton
2019-01-28 19:00   ` Kees Cook
2019-01-28 19:00     ` Kees Cook
2019-01-28 20:08     ` Christopher Lameter
2019-01-28 20:08       ` Christopher Lameter
2019-01-31  0:37 ` Michael Ellerman
2019-01-31  0:37   ` Michael Ellerman
2019-01-31  6:03 ` Pekka Enberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.