Fix /proc/pid/pagemap end address calculation
Subsystems (2)
PATCH 1/1 Fix /proc/pid/pagemap end address calculation
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
--- fs/proc/task_mmu.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/proc/task_mmu.c +1 -1
@@ -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 ;
Signature · 1 line
1.4.4.2
Quoted 10 lines · Dave Boutcher
When dumping vma information the
pagemap_readroutine calculates the minimum of what the user asks for and the end of the vma. Unfortunately the code usesvma->vm_startrather thanvma->vm_endwhich 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 <[email protected]>
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.
Quoted 25 lines
--- fs/proc/task_mmu.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)fs/proc/task_mmu.c +1
-1@@ -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 ;Signature · 7 lines
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/
Signature · 1 line
Mathematics is the supreme nostalgia of our time.