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: <4E02DB80.10303@jp.fujitsu.com>
Date:	Thu, 23 Jun 2011 15:21:52 +0900
From:	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To:	tglx@...utronix.de, dvhart@...ux.intel.com,
	linux-kernel@...r.kernel.org, mingo@...e.hu, a.p.zijlstra@...llo.nl
CC:	kosaki.motohiro@...fujitsu.com
Subject: [RFC PATCH] futex: replace get_user_pages() with get_user_pages_fast()

Hello,

Is there any reason to take mmap_sem explicitly here?
Should we change gup_fast() to allow NULL argument (ie for avoid get_page)?

============================
  down_read(&mm->mmap_sem);
  get_user_pages(current, current->mm)
  up_read(&mm->mmap_sem);

and

  get_user_pages_fast()

make an equivalent result, And latter would be better when mamp_sem
highly contended case, because it can avoid to take mmap_sem if
the target page doesn't need a page fault.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
---
 kernel/futex.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index fe28dc2..9f7b1ae 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -351,13 +351,11 @@ static inline void put_futex_key(union futex_key *key)
  */
 static int fault_in_user_writeable(u32 __user *uaddr)
 {
-	struct mm_struct *mm = current->mm;
 	int ret;
+	struct page *page;

-	down_read(&mm->mmap_sem);
-	ret = get_user_pages(current, mm, (unsigned long)uaddr,
-			     1, 1, 0, NULL, NULL);
-	up_read(&mm->mmap_sem);
+	ret = get_user_pages_fast((unsigned long)uaddr, 1, 1, &page);
+	put_page(page);

 	return ret < 0 ? ret : 0;
 }
-- 
1.7.3.1


--
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