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] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0812090811450.13181@quilx.com>
Date:	Tue, 9 Dec 2008 08:19:31 -0600 (CST)
From:	Christoph Lameter <cl@...ux-foundation.org>
To:	Brice Goglin <Brice.Goglin@...ia.fr>
cc:	Andrew Morton <akpm@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RFC/PATCH] No get_user/put_user while holding mmap_sem in
 do_pages_stat?

I guess the simplest solution would be to move the taking of mmap_sem into
the loop. Mean taking mmap_sem for every page that we determine the status of.

Signed-off-by: Christoph Lameter <clameter@....com>

Index: linux-2.6/mm/migrate.c
===================================================================
--- linux-2.6.orig/mm/migrate.c	2008-12-09 08:07:08.796603952 -0600
+++ linux-2.6/mm/migrate.c	2008-12-09 08:08:36.400116263 -0600
@@ -994,8 +994,6 @@
 	unsigned long i;
 	int err;

-	down_read(&mm->mmap_sem);
-
 	for (i = 0; i < nr_pages; i++) {
 		const void __user *p;
 		unsigned long addr;
@@ -1007,12 +1005,17 @@
 			goto out;
 		addr = (unsigned long) p;

+		down_read(&mm->mmap_sem);
+
 		vma = find_vma(mm, addr);
-		if (!vma)
+		if (!vma) {
+			up_read(&mm->mmap_sem);
 			goto set_status;
-
+		}
 		page = follow_page(vma, addr, 0);

+		up_read(&mm->mmap_sem);
+
 		err = PTR_ERR(page);
 		if (IS_ERR(page))
 			goto set_status;
@@ -1029,7 +1032,6 @@
 	err = 0;

 out:
-	up_read(&mm->mmap_sem);
 	return err;
 }

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