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]
Date:	Fri, 4 Jul 2008 18:53:12 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	"Alexey Dobriyan" <adobriyan@...il.com>
Cc:	torvalds@...uxfoundation.org, akpm@...uxfoundation.org,
	mpm@...enic.com, linux-kernel@...r.kernel.org
Subject: Re: *sigh* /proc/*/pagemap

On Sat, 5 Jul 2008 05:07:02 +0400 "Alexey Dobriyan" <adobriyan@...il.com> wrote:

> I'm few days from my patch-sending facility, but could someone
> _please_ do the following before release:
> 
> 1) initialize pagemap_walk.mm to "mm" , so the code starts working as
> advertised, and
> 2) also initialize ->private to "&pm" so it wouldn't immediately oops
> in pagemap_pte_hole(), and

Geeze you're picky!  If everyone was like you we wouldn't need that
nice oops-printing code.

> 3) unstatic struct pagemap_walk, so two threads won't fsckup each other
>    (including those started by root, including flipping ->mm when you
> don't have permissions),

Below

>     and
> 4) remove second ptrace_may_attach(), and

Can't find what you're referring to here.

> 5) check with microscope allocation there -- page-aligned address and size == 0
>     should allocate 0 bytes, and

Where?

> 6) actually check that it works.

Will have a shot.

From: Andrew Morton <akpm@...ux-foundation.org>

- initialize pagemap_walk.mm to "mm" , so the code starts working as
  advertised

- initialize ->private to "&pm" so it wouldn't immediately oops in
  pagemap_pte_hole()

- unstatic struct pagemap_walk, so two threads won't fsckup each other
  (including those started by root, including flipping ->mm when you don't
  have permissions)



Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
---

 fs/proc/task_mmu.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff -puN fs/proc/task_mmu.c~pagemap-fixes-to-pagemap_read fs/proc/task_mmu.c
--- a/fs/proc/task_mmu.c~pagemap-fixes-to-pagemap_read
+++ a/fs/proc/task_mmu.c
@@ -602,11 +602,6 @@ static int pagemap_pte_range(pmd_t *pmd,
 	return err;
 }
 
-static struct mm_walk pagemap_walk = {
-	.pmd_entry = pagemap_pte_range,
-	.pte_hole = pagemap_pte_hole
-};
-
 /*
  * /proc/pid/pagemap - an array mapping virtual pages to pfns
  *
@@ -641,6 +636,7 @@ static ssize_t pagemap_read(struct file 
 	struct pagemapread pm;
 	int pagecount;
 	int ret = -ESRCH;
+	static struct mm_walk pagemap_walk;
 
 	if (!task)
 		goto out;
@@ -659,6 +655,7 @@ static ssize_t pagemap_read(struct file 
 	if (!mm)
 		goto out_task;
 
+
 	ret = -ENOMEM;
 	uaddr = (unsigned long)buf & PAGE_MASK;
 	uend = (unsigned long)(buf + count);
@@ -684,6 +681,11 @@ static ssize_t pagemap_read(struct file 
 	pm.out = (u64 *)buf;
 	pm.end = (u64 *)(buf + count);
 
+	pagemap_walk.pmd_entry = pagemap_pte_range;
+	pagemap_walk.pte_hole = pagemap_pte_hole;
+	pagemap_walk.mm = mm;
+	pagemap_walk.private = &pm;
+
 	if (!ptrace_may_attach(task)) {
 		ret = -EIO;
 	} else {
_

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