lkml.org 
[lkml]   [2011]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm/mempolicy.c: fix pgoff in mbind vma merge
On Mon,  1 Aug 2011 23:28:55 +0800
Caspar Zhang <caspar@casparzhang.com> wrote:

> commit 9d8cebd4bcd7c3878462fdfda34bbcdeb4df7ef4 didn't real fix the
> mbind vma merge problem due to wrong pgoff value passing to vma_merge(),
> which made vma_merge() always return NULL.
>
> Re-tested the patched kernel with the reproducer provided in commit
> 9d8cebd, got correct result like below:
>
> addr = 0x7ffa5aaa2000
> [snip]
> 7ffa5aaa2000-7ffa5aaa6000 rw-p 00000000 00:00 0
> 7fffd556f000-7fffd5584000 rw-p 00000000 00:00 0 [stack]
>

Please also describe the output before the patch is applied, and tell
us what you believe is wrong with it?

> --- a/mm/mempolicy.c
> +++ b/mm/mempolicy.c
> @@ -636,7 +636,6 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
> struct vm_area_struct *prev;
> struct vm_area_struct *vma;
> int err = 0;
> - pgoff_t pgoff;
> unsigned long vmstart;
> unsigned long vmend;
>
> @@ -649,9 +648,9 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
> vmstart = max(start, vma->vm_start);
> vmend = min(end, vma->vm_end);
>
> - pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT);
> prev = vma_merge(mm, prev, vmstart, vmend, vma->vm_flags,
> - vma->anon_vma, vma->vm_file, pgoff, new_pol);
> + vma->anon_vma, vma->vm_file, vma->vm_pgoff,
> + new_pol);
> if (prev) {
> vma = prev;
> next = vma->vm_next;
> --
> 1.7.6


\
 
 \ /
  Last update: 2011-08-26 23:25    [W:0.069 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site