linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: fix use-after-free in sys_remap_file_pages
@ 2013-12-12 22:07 Kees Cook
  2013-12-13  3:41 ` Rik van Riel
  0 siblings, 1 reply; 5+ messages in thread
From: Kees Cook @ 2013-12-12 22:07 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, Michel Lespinasse, Rik van Riel, Cyrill Gorcunov,
	Hugh Dickins, linux-mm, PaX Team, Dmitry Vyukov

From: PaX Team <pageexec@freemail.hu>

http://lkml.org/lkml/2013/9/17/30

SyS_remap_file_pages() calls mmap_region(), which calls remove_vma_list(),
which calls remove_vma(), which frees the vma.  Later (after out label)
SyS_remap_file_pages() accesses the freed vma in vm_flags = vma->vm_flags.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: PaX Team <pageexec@freemail.hu>
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: stable@vger.kernel.org
---
 mm/fremap.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/fremap.c b/mm/fremap.c
index 5bff08147768..afad07b85ef2 100644
--- a/mm/fremap.c
+++ b/mm/fremap.c
@@ -218,6 +218,8 @@ get_write_lock:
 				BUG_ON(addr != start);
 				err = 0;
 			}
+			vm_flags = vma->vm_flags;
+			vma = NULL;
 			goto out;
 		}
 		mutex_lock(&mapping->i_mmap_mutex);
-- 
1.7.9.5


-- 
Kees Cook
Chrome OS Security

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2013-12-13 15:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-12 22:07 [PATCH] mm: fix use-after-free in sys_remap_file_pages Kees Cook
2013-12-13  3:41 ` Rik van Riel
2013-12-13  6:24   ` Cyrill Gorcunov
2013-12-13 11:10   ` PaX Team
2013-12-13 14:43     ` [PATCH -v2] " Rik van Riel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).