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-next>] [day] [month] [year] [list]
Message-ID: <20091208121942.GA21298@basil.fritz.box>
Date:	Tue, 8 Dec 2009 13:19:42 +0100
From:	Andi Kleen <andi@...stfloor.org>
To:	akpm@...l.org, linux-kernel@...r.kernel.org, npiggin@...e.de,
	tglx@...utronix.de, dvhltc@...ibm.com
Cc:	stable@...nel.org
Subject: [PATCH] futex: Take mmap_sem for get_user_pages in
	fault_in_user_writeable

futex: Take mmap_sem for get_user_pages in fault_in_user_writeable

gup() requires mmap_sem, so take it before running it. The
recent fault_in_user_writeable() didn't do that.

I didn't find a good futex test case, so untested.

Likely a stable candidate.

Cc: npiggin@...e.de
Cc: tglx@...utronix.de
Cc: dvhltc@...ibm.com
Signed-off-by: Andi Kleen <ak@...ux.intel.com>

---
 kernel/futex.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Index: linux-2.6.32-ak/kernel/futex.c
===================================================================
--- linux-2.6.32-ak.orig/kernel/futex.c
+++ linux-2.6.32-ak/kernel/futex.c
@@ -304,8 +304,13 @@ void put_futex_key(int fshared, union fu
  */
 static int fault_in_user_writeable(u32 __user *uaddr)
 {
-	int ret = get_user_pages(current, current->mm, (unsigned long)uaddr,
+	int ret;
+	struct mm_struct *mm = current->mm;
+
+	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