mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: boutcher@cs.umn.edu (Dave Boutcher)
To: Matt Mackall <mpm@selenic.com>
Cc: linux-kernel@vger.kernel.org, Dave Hansen <haveblue@us.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 3/3] Fix /proc/pid/pagemap unmapped page handling
Date: Mon, 6 Aug 2007 01:44:57 -0500	[thread overview]
Message-ID: <18102.50025.384989.809593@gargle.gargle.HOWL> (raw)
In-Reply-To: <af12424c6e31474e5e7227e34854b29fa8a128db.1186382353.git.boutcher@cs.umn.edu>

When reading /proc/pid/pagemap at an offset that
does not contain mapped pages, call pagemap_fill
to fill the buffer with -1 until either the end,
or a valid vma is encountered.

Signed-off-by: Dave Boutcher <boutcher@cs.umn.edu>
---
 fs/proc/task_mmu.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 1f78cb4..3978f31 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -671,10 +671,12 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
 			ret = -EIO;
 			goto out_mm;
 		}
-		vend = min(vma->vm_start - 1, end - 1) + 1;
-		ret = pagemap_fill(&pm, vend);
-		if (ret || !pm.count)
-			break;
+		if (pm.next < vma->vm_start) {
+			vend = min(vma->vm_start - 1, end - 1) + 1;
+			pagemap_fill(&pm, vend);
+			continue;
+		}
+
 		vend = min(vma->vm_end - 1, end - 1) + 1;
 		ret = walk_page_range(mm, vma->vm_start, vend,
 				      &pagemap_walk, &pm);
-- 
1.4.4.2


      parent reply	other threads:[~2007-08-06  6:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <af12424c6e31474e5e7227e34854b29fa8a128db.1186382353.git.boutcher@cs.umn.edu>
2007-08-06  6:44 ` [PATCH 1/3] Fix /proc/pid/pagemap return length calculation Dave Boutcher
2007-08-06  6:44 ` [PATCH 2/3] Fix /proc/pid/pagemap header copy to userspace Dave Boutcher
2007-08-06  6:44 ` Dave Boutcher [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18102.50025.384989.809593@gargle.gargle.HOWL \
    --to=boutcher@cs.umn.edu \
    --cc=akpm@linux-foundation.org \
    --cc=haveblue@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®