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
Subject: [PATCH] Fix /proc/pid/pagemap end address calculation
Date: Sun, 5 Aug 2007 21:03:28 -0500	[thread overview]
Message-ID: <18102.33136.963233.867247@gargle.gargle.HOWL> (raw)


When dumping vma information the pagemap_read routine calculates
the minimum of what the user asks for and the end of the vma.
Unfortunately the code uses vma->vm_start rather than vma->vm_end
which can result in the end address being before the start, and
a nasty never-ending loop in the kernel.

Diffed against 2.6.23-rc1-mm2

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

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index b2baeab..b12740c 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -671,7 +671,7 @@ 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;
+		vend = min(vma->vm_end - 1, end - 1) + 1;
 		ret = pagemap_fill(&pm, vend);
 		if (ret || !pm.count)
 			break;
-- 
1.4.4.2


             reply	other threads:[~2007-08-06  2:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-06  2:03 Dave Boutcher [this message]
2007-08-06  2:41 ` Matt Mackall

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.33136.963233.867247@gargle.gargle.HOWL \
    --to=boutcher@cs.umn.edu \
    --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®