lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-722d0172377a5697919b9f7e5beb95165b1dec4e@git.kernel.org>
Date:	Tue, 8 Dec 2009 14:03:32 GMT
From:	tip-bot for Andi Kleen <andi@...stfloor.org>
To:	linux-tip-commits@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org, dvhltc@...ibm.com,
	akpm@...uxfoundation.org, hpa@...or.com, mingo@...hat.com,
	andi@...stfloor.org, peterz@...radead.org, npiggin@...e.de,
	ak@...ux.intel.com, tglx@...utronix.de
Subject: [tip:core/urgent] futex: Take mmap_sem for get_user_pages in fault_in_user_writeable

Commit-ID:  722d0172377a5697919b9f7e5beb95165b1dec4e
Gitweb:     http://git.kernel.org/tip/722d0172377a5697919b9f7e5beb95165b1dec4e
Author:     Andi Kleen <andi@...stfloor.org>
AuthorDate: Tue, 8 Dec 2009 13:19:42 +0100
Committer:  Thomas Gleixner <tglx@...utronix.de>
CommitDate: Tue, 8 Dec 2009 14:59:36 +0100

futex: Take mmap_sem for get_user_pages in fault_in_user_writeable

get_user_pages() must be called with mmap_sem held.

Signed-off-by: Andi Kleen <ak@...ux.intel.com>
Cc: stable@...nel.org
Cc: Andrew Morton <akpm@...uxfoundation.org>
Cc: Nick Piggin <npiggin@...e.de>
Cc: Darren Hart <dvhltc@...ibm.com>
Cc: Peter Zijlstra <peterz@...radead.org>
LKML-Reference: <20091208121942.GA21298@...il.fritz.box>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>

---
 kernel/futex.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index fb65e82..d73ef1f 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -304,8 +304,14 @@ void put_futex_key(int fshared, union futex_key *key)
  */
 static int fault_in_user_writeable(u32 __user *uaddr)
 {
-	int ret = get_user_pages(current, current->mm, (unsigned long)uaddr,
-				 1, 1, 0, NULL, NULL);
+	struct mm_struct *mm = current->mm;
+	int ret;
+
+	down_read(&mm->mmap_sem);
+	ret = get_user_pages(current, mm, (unsigned long)uaddr,
+			     1, 1, 0, NULL, NULL);
+	up_read(&mm->mmap_sem);
+
 	return ret < 0 ? ret : 0;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ