All of lore.kernel.org
 help / color / mirror / Atom feed
* + mm-pagemap-limit-scan-to-virtual-region-being-asked.patch added to -mm tree
@ 2015-01-14  0:15 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2015-01-14  0:15 UTC (permalink / raw)
  To: shashim, gorcunov, oleg, mm-commits


The patch titled
     Subject: mm: pagemap_read: limit scan to virtual region being asked
has been added to the -mm tree.  Its filename is
     mm-pagemap-limit-scan-to-virtual-region-being-asked.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-pagemap-limit-scan-to-virtual-region-being-asked.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-pagemap-limit-scan-to-virtual-region-being-asked.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Shiraz Hashim <shashim@codeaurora.org>
Subject: mm: pagemap_read: limit scan to virtual region being asked

pagemap_read scans through the virtual address space of a task until it
prepares 'count' pagemaps or it reaches end of task.

This presents a problem when the page walk doesn't happen for a vma with
VM_PFNMAP set.  In this case the walk is silently skipped and no pagemap
is prepared, in turn making pagemap_read scan through to task end, even
crossing beyond 'count', landing into a different vma region.  This leads
to wrong presentation of mappings for that vma.

Fix this by limiting end_vaddr to the end of the virtual address region
being scanned.

Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/proc/task_mmu.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff -puN fs/proc/task_mmu.c~mm-pagemap-limit-scan-to-virtual-region-being-asked fs/proc/task_mmu.c
--- a/fs/proc/task_mmu.c~mm-pagemap-limit-scan-to-virtual-region-being-asked
+++ a/fs/proc/task_mmu.c
@@ -1254,7 +1254,9 @@ static ssize_t pagemap_read(struct file
 	src = *ppos;
 	svpfn = src / PM_ENTRY_BYTES;
 	start_vaddr = svpfn << PAGE_SHIFT;
-	end_vaddr = TASK_SIZE_OF(task);
+	end_vaddr = start_vaddr + ((count / PM_ENTRY_BYTES) << PAGE_SHIFT);
+	if ((end_vaddr > TASK_SIZE_OF(task)) || (end_vaddr < start_vaddr))
+		end_vaddr = TASK_SIZE_OF(task);
 
 	/* watch out for wraparound */
 	if (svpfn > TASK_SIZE_OF(task) >> PAGE_SHIFT)
_

Patches currently in -mm which might be from shashim@codeaurora.org are

mm-pagemap-limit-scan-to-virtual-region-being-asked.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-01-14  0:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-14  0:15 + mm-pagemap-limit-scan-to-virtual-region-being-asked.patch added to -mm tree akpm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.