Message ID | 1463753785-30158-2-git-send-email-colin.king@canonical.com |
---|---|
State | New |
Headers | show |
On Fri, May 20, 2016 at 03:16:25PM +0100, Colin King wrote: > From: "J. R. Okajima" <hooanon05g@gmail.com> > > BugLink: http://bugs.launchpad.net/bugs/1558120 > > This is essentially same to the past commit for aufs3.9 > f84155f 2014-06-11 aufs mmap: bugfix remap_file_pages(2) > > But the remap_file_pages(2) changed drastically in linux-4.0 by > c8d78c1 2015-02-10 mm: replace remap_file_pages() syscall with emulation > and then a bugfix was commited in linux-4.5-rc5. > 48f7df3 2016-02-18 mm: fix regression in remap_file_pages() emulation > > After the bugfix in 4.5-rc5, Colin Ian King found and reported this aufs > bug. > > See-also: https://github.com/sfjro/aufs4-linux/pull/1 > Signed-off-by: J. R. Okajima <hooanon05g@gmail.com> > (cherry picked from commit ea98b4d56b605fc4fc35a9f05c597e36308197b0) NAK, because that SHA does not appear in mainline linux, so needs a URL to the repo from whence it came. Colin, please correct and resubmit! -Kamal > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > mm/mmap.c | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) > > diff --git a/mm/mmap.c b/mm/mmap.c > index f8854ad..f8c73f6 100644 > --- a/mm/mmap.c > +++ b/mm/mmap.c > @@ -2630,6 +2630,7 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, > struct vm_area_struct *vma; > unsigned long populate = 0; > unsigned long ret = -EINVAL; > + struct file *file, *prfile; > > pr_warn_once("%s (%d) uses deprecated remap_file_pages() syscall. " > "See Documentation/vm/remap_file_pages.txt.\n", > @@ -2698,9 +2699,26 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, > } > > vma_get_file(vma); > + file = vma->vm_file; > + prfile = vma->vm_prfile; > ret = do_mmap_pgoff(vma->vm_file, start, size, > prot, flags, pgoff, &populate); > - vma_fput(vma); > + if (!IS_ERR_VALUE(ret) && file && prfile) { > + struct vm_area_struct *new_vma; > + > + new_vma = find_vma(mm, ret); > + if (!new_vma->vm_prfile) > + new_vma->vm_prfile = prfile; > + if (new_vma != vma) > + get_file(prfile); > + } > + /* > + * two fput()s instead of vma_fput(vma), > + * coz vma may not be available anymore. > + */ > + fput(file); > + if (prfile) > + fput(prfile); > out: > up_write(&mm->mmap_sem); > if (populate) > -- > 2.8.1 > > > -- > kernel-team mailing list > kernel-team@lists.ubuntu.com > https://lists.ubuntu.com/mailman/listinfo/kernel-team
Kamal - I've refreshed my repos with the correct AUFS upstream commit and nomenclature. git://kernel.ubuntu.com/rtg/ubuntu-wily.git lp1558120 git://kernel.ubuntu.com/rtg/ubuntu-xenial.git lp1558120 rtg
On Fri, May 20, 2016 at 01:52:48PM -0600, Tim Gardner wrote: > Kamal - I've refreshed my repos with the correct AUFS upstream commit > and nomenclature. > > git://kernel.ubuntu.com/rtg/ubuntu-wily.git lp1558120 > git://kernel.ubuntu.com/rtg/ubuntu-xenial.git lp1558120 Thanks very much, Tim. Applied to Wily and Xenial. -Kamal
diff --git a/mm/mmap.c b/mm/mmap.c index f8854ad..f8c73f6 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2630,6 +2630,7 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, struct vm_area_struct *vma; unsigned long populate = 0; unsigned long ret = -EINVAL; + struct file *file, *prfile; pr_warn_once("%s (%d) uses deprecated remap_file_pages() syscall. " "See Documentation/vm/remap_file_pages.txt.\n", @@ -2698,9 +2699,26 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, } vma_get_file(vma); + file = vma->vm_file; + prfile = vma->vm_prfile; ret = do_mmap_pgoff(vma->vm_file, start, size, prot, flags, pgoff, &populate); - vma_fput(vma); + if (!IS_ERR_VALUE(ret) && file && prfile) { + struct vm_area_struct *new_vma; + + new_vma = find_vma(mm, ret); + if (!new_vma->vm_prfile) + new_vma->vm_prfile = prfile; + if (new_vma != vma) + get_file(prfile); + } + /* + * two fput()s instead of vma_fput(vma), + * coz vma may not be available anymore. + */ + fput(file); + if (prfile) + fput(prfile); out: up_write(&mm->mmap_sem); if (populate)