* [PATCH] mm: pagewalk: call pte_hole() for VM_PFNMAP during walk_page_range
@ 2015-01-21 6:13 Shiraz Hashim
2015-01-21 6:30 ` Naoya Horiguchi
2015-01-22 20:08 ` Andrew Morton
0 siblings, 2 replies; 3+ messages in thread
From: Shiraz Hashim @ 2015-01-21 6:13 UTC (permalink / raw)
To: linux-mm; +Cc: akpm, oleg, gorcunov, linux-kernel, n-horiguchi, Shiraz Hashim
walk_page_range silently skips vma having VM_PFNMAP set,
which leads to undesirable behaviour at client end (who
called walk_page_range). For example for pagemap_read,
when no callbacks are called against VM_PFNMAP vma,
pagemap_read may prepare pagemap data for next virtual
address range at wrong index.
Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
---
The fix is revised, based upon the suggestion here at
http://www.spinics.net/lists/linux-mm/msg83058.html
mm/pagewalk.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/mm/pagewalk.c b/mm/pagewalk.c
index ad83195..b264bda 100644
--- a/mm/pagewalk.c
+++ b/mm/pagewalk.c
@@ -199,7 +199,10 @@ int walk_page_range(unsigned long addr, unsigned long end,
*/
if ((vma->vm_start <= addr) &&
(vma->vm_flags & VM_PFNMAP)) {
- next = vma->vm_end;
+ if (walk->pte_hole)
+ err = walk->pte_hole(addr, next, walk);
+ if (err)
+ break;
pgd = pgd_offset(walk->mm, next);
continue;
}
--
Shiraz Hashim
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of the Code Aurora Forum, hosted by The Linux Foundation
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: pagewalk: call pte_hole() for VM_PFNMAP during walk_page_range
2015-01-21 6:13 [PATCH] mm: pagewalk: call pte_hole() for VM_PFNMAP during walk_page_range Shiraz Hashim
@ 2015-01-21 6:30 ` Naoya Horiguchi
2015-01-22 20:08 ` Andrew Morton
1 sibling, 0 replies; 3+ messages in thread
From: Naoya Horiguchi @ 2015-01-21 6:30 UTC (permalink / raw)
To: Shiraz Hashim
Cc: linux-mm@kvack.org, akpm@linux-foundation.org, oleg@redhat.com,
gorcunov@openvz.org, linux-kernel@vger.kernel.org
On Wed, Jan 21, 2015 at 11:43:13AM +0530, Shiraz Hashim wrote:
> walk_page_range silently skips vma having VM_PFNMAP set,
> which leads to undesirable behaviour at client end (who
> called walk_page_range). For example for pagemap_read,
> when no callbacks are called against VM_PFNMAP vma,
> pagemap_read may prepare pagemap data for next virtual
> address range at wrong index.
>
> Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
Thank you!
Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> ---
> The fix is revised, based upon the suggestion here at
> http://www.spinics.net/lists/linux-mm/msg83058.html
>
> mm/pagewalk.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/mm/pagewalk.c b/mm/pagewalk.c
> index ad83195..b264bda 100644
> --- a/mm/pagewalk.c
> +++ b/mm/pagewalk.c
> @@ -199,7 +199,10 @@ int walk_page_range(unsigned long addr, unsigned long end,
> */
> if ((vma->vm_start <= addr) &&
> (vma->vm_flags & VM_PFNMAP)) {
> - next = vma->vm_end;
> + if (walk->pte_hole)
> + err = walk->pte_hole(addr, next, walk);
> + if (err)
> + break;
> pgd = pgd_offset(walk->mm, next);
> continue;
> }
> --
> Shiraz Hashim
>
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
> member of the Code Aurora Forum, hosted by The Linux Foundation
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: pagewalk: call pte_hole() for VM_PFNMAP during walk_page_range
2015-01-21 6:13 [PATCH] mm: pagewalk: call pte_hole() for VM_PFNMAP during walk_page_range Shiraz Hashim
2015-01-21 6:30 ` Naoya Horiguchi
@ 2015-01-22 20:08 ` Andrew Morton
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2015-01-22 20:08 UTC (permalink / raw)
To: Shiraz Hashim; +Cc: linux-mm, oleg, gorcunov, linux-kernel, n-horiguchi
On Wed, 21 Jan 2015 11:43:13 +0530 Shiraz Hashim <shashim@codeaurora.org> wrote:
> walk_page_range silently skips vma having VM_PFNMAP set,
> which leads to undesirable behaviour at client end (who
> called walk_page_range). For example for pagemap_read,
> when no callbacks are called against VM_PFNMAP vma,
> pagemap_read may prepare pagemap data for next virtual
> address range at wrong index.
This changelog doesn't have enough information for me to be able to
work out whether a -stable backport is needed. Please always describe
the user-visible effects of a bug.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-22 20:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-21 6:13 [PATCH] mm: pagewalk: call pte_hole() for VM_PFNMAP during walk_page_range Shiraz Hashim
2015-01-21 6:30 ` Naoya Horiguchi
2015-01-22 20:08 ` Andrew Morton
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).