All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sonny Rao <sonnyrao@us.ibm.com>
To: tglx@linuxtronix.de
Cc: mingo@redhat.com, linux-kernel@vger.kernel.org,
	linux-mm@vger.kernel.org, sonnyrao@us.ibm.com, stable@kernel.org,
	anton@samba.org, rajamony@us.ibm.com, speight@us.ibm.com,
	mstephen@us.ibm.com, grimm@us.ibm.com, mikey@ozlabs.au.ibm.com
Subject: [PATCH] futexs: fix infinite loop in get_futex_key on huge page
Date: Fri, 10 Jul 2009 18:13:13 -0500	[thread overview]
Message-ID: <20090710231313.GA23572@us.ibm.com> (raw)

get_futex_key() can infinitely loop if it is called on a virtual address
that is within a huge page but not aligned to the beginning of that
page.  The call to get_user_pages_fast will return the struct page for
a sub-page within the huge page and the check for page->mapping will
always fail.

The fix is to call compound_head on the page before checking that it's mapped.

Signed-off-by: Sonny Rao <sonnyrao@us.ibm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: stable@kernel.org

Index: linux-2.6.31-rc2/kernel/futex.c
===================================================================
--- linux-2.6.31-rc2.orig/kernel/futex.c	2009-07-10 17:45:46.181084475 -0500
+++ linux-2.6.31-rc2/kernel/futex.c	2009-07-10 17:46:47.345084062 -0500
@@ -247,6 +247,7 @@
 	if (err < 0)
 		return err;
 
+	page = compound_head(page);
 	lock_page(page);
 	if (!page->mapping) {
 		unlock_page(page);

             reply	other threads:[~2009-07-10 23:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-10 23:13 Sonny Rao [this message]
2009-07-11  8:19 ` [PATCH] futexs: fix infinite loop in get_futex_key on huge page Ingo Molnar
2009-07-11 10:14   ` Thomas Gleixner
2009-07-11  8:22 ` [tip:core/urgent] futexes: Fix infinite loop in get_futex_key() " tip-bot for Sonny Rao
2009-07-11 10:42 ` tip-bot for Sonny Rao

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=20090710231313.GA23572@us.ibm.com \
    --to=sonnyrao@us.ibm.com \
    --cc=anton@samba.org \
    --cc=grimm@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@vger.kernel.org \
    --cc=mikey@ozlabs.au.ibm.com \
    --cc=mingo@redhat.com \
    --cc=mstephen@us.ibm.com \
    --cc=rajamony@us.ibm.com \
    --cc=speight@us.ibm.com \
    --cc=stable@kernel.org \
    --cc=tglx@linuxtronix.de \
    /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 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.