[PATCH 3/3] Fix /proc/pid/pagemap unmapped page handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>
---
 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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux