linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Michel Lespinasse <walken@google.com>,
	Rik van Riel <riel@redhat.com>,
	Cyrill Gorcunov <gorcunov@openvz.org>,
	Hugh Dickins <hughd@google.com>,
	linux-mm@kvack.org, PaX Team <pageexec@freemail.hu>,
	Dmitry Vyukov <dvyukov@google.com>
Subject: [PATCH] mm: fix use-after-free in sys_remap_file_pages
Date: Thu, 12 Dec 2013 14:07:57 -0800	[thread overview]
Message-ID: <20131212220757.GA14928@www.outflux.net> (raw)

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>

             reply	other threads:[~2013-12-12 22:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-12 22:07 Kees Cook [this message]
2013-12-13  3:41 ` [PATCH] mm: fix use-after-free in sys_remap_file_pages 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131212220757.GA14928@www.outflux.net \
    --to=keescook@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=dvyukov@google.com \
    --cc=gorcunov@openvz.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pageexec@freemail.hu \
    --cc=riel@redhat.com \
    --cc=walken@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).