linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix /proc/pid/pagemap end address calculation
@ 2007-08-06  2:03 Dave Boutcher
  2007-08-06  2:41 ` Matt Mackall
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Boutcher @ 2007-08-06  2:03 UTC (permalink / raw)
  To: Matt Mackall; +Cc: linux-kernel


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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix /proc/pid/pagemap end address calculation
  2007-08-06  2:03 [PATCH] Fix /proc/pid/pagemap end address calculation Dave Boutcher
@ 2007-08-06  2:41 ` Matt Mackall
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Mackall @ 2007-08-06  2:41 UTC (permalink / raw)
  To: Dave Boutcher; +Cc: linux-kernel, Dave Hansen, Andrew Morton

On Sun, Aug 05, 2007 at 09:03:28PM -0500, Dave Boutcher wrote:
> 
> 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>

Thanks, Dave. I've added this fix to my local tree. It's still in a
broken state at the moment, so Andrew, feel free to pick this up.

Acked-by: Matt Mackall <mpm@selenic.com>

> ---
>  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
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Mathematics is the supreme nostalgia of our time.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-06  2:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-06  2:03 [PATCH] Fix /proc/pid/pagemap end address calculation Dave Boutcher
2007-08-06  2:41 ` Matt Mackall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).