* [PATCH] fix error reporting in move_pages syscall
@ 2010-10-19 10:15 Gleb Natapov
2010-10-21 18:27 ` Gleb Natapov
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Gleb Natapov @ 2010-10-19 10:15 UTC (permalink / raw)
To: linux-mm; +Cc: cl
vma returned by find_vma does not necessary include given address. If
this happens code tries to follow page outside of any vma and returns
ENOENT instead of EFAULT.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
diff --git a/mm/migrate.c b/mm/migrate.c
index 38e7cad..b91a253 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -841,7 +841,7 @@ static int do_move_page_to_node_array(struct mm_struct *mm,
err = -EFAULT;
vma = find_vma(mm, pp->addr);
- if (!vma || !vma_migratable(vma))
+ if (!vma || pp->addr < vma->vm_start || !vma_migratable(vma))
goto set_status;
page = follow_page(vma, pp->addr, FOLL_GET);
@@ -1005,7 +1005,7 @@ static void do_pages_stat_array(struct mm_struct *mm, unsigned long nr_pages,
int err = -EFAULT;
vma = find_vma(mm, addr);
- if (!vma)
+ if (!vma || addr < vma->vm_start)
goto set_status;
page = follow_page(vma, addr, 0);
--
Gleb.
--
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] 4+ messages in thread
* Re: [PATCH] fix error reporting in move_pages syscall
2010-10-19 10:15 [PATCH] fix error reporting in move_pages syscall Gleb Natapov
@ 2010-10-21 18:27 ` Gleb Natapov
2010-10-21 18:55 ` Christoph Lameter
2010-10-22 2:12 ` KOSAKI Motohiro
2 siblings, 0 replies; 4+ messages in thread
From: Gleb Natapov @ 2010-10-21 18:27 UTC (permalink / raw)
To: linux-mm; +Cc: cl, cl, akpm
ping?
On Tue, Oct 19, 2010 at 12:15:05PM +0200, Gleb Natapov wrote:
> vma returned by find_vma does not necessary include given address. If
> this happens code tries to follow page outside of any vma and returns
> ENOENT instead of EFAULT.
>
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 38e7cad..b91a253 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -841,7 +841,7 @@ static int do_move_page_to_node_array(struct mm_struct *mm,
>
> err = -EFAULT;
> vma = find_vma(mm, pp->addr);
> - if (!vma || !vma_migratable(vma))
> + if (!vma || pp->addr < vma->vm_start || !vma_migratable(vma))
> goto set_status;
>
> page = follow_page(vma, pp->addr, FOLL_GET);
> @@ -1005,7 +1005,7 @@ static void do_pages_stat_array(struct mm_struct *mm, unsigned long nr_pages,
> int err = -EFAULT;
>
> vma = find_vma(mm, addr);
> - if (!vma)
> + if (!vma || addr < vma->vm_start)
> goto set_status;
>
> page = follow_page(vma, addr, 0);
> --
> Gleb.
>
> --
> 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>
--
Gleb.
--
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] 4+ messages in thread
* Re: [PATCH] fix error reporting in move_pages syscall
2010-10-19 10:15 [PATCH] fix error reporting in move_pages syscall Gleb Natapov
2010-10-21 18:27 ` Gleb Natapov
@ 2010-10-21 18:55 ` Christoph Lameter
2010-10-22 2:12 ` KOSAKI Motohiro
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Lameter @ 2010-10-21 18:55 UTC (permalink / raw)
To: Gleb Natapov; +Cc: linux-mm
On Tue, 19 Oct 2010, Gleb Natapov wrote:
> vma returned by find_vma does not necessary include given address. If
> this happens code tries to follow page outside of any vma and returns
> ENOENT instead of EFAULT.
Acked-by: Christoph Lameter <cl@linux.com>
--
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] 4+ messages in thread
* Re: [PATCH] fix error reporting in move_pages syscall
2010-10-19 10:15 [PATCH] fix error reporting in move_pages syscall Gleb Natapov
2010-10-21 18:27 ` Gleb Natapov
2010-10-21 18:55 ` Christoph Lameter
@ 2010-10-22 2:12 ` KOSAKI Motohiro
2 siblings, 0 replies; 4+ messages in thread
From: KOSAKI Motohiro @ 2010-10-22 2:12 UTC (permalink / raw)
To: Gleb Natapov; +Cc: kosaki.motohiro, linux-mm, cl
> vma returned by find_vma does not necessary include given address. If
> this happens code tries to follow page outside of any vma and returns
> ENOENT instead of EFAULT.
>
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 38e7cad..b91a253 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -841,7 +841,7 @@ static int do_move_page_to_node_array(struct mm_struct *mm,
>
> err = -EFAULT;
> vma = find_vma(mm, pp->addr);
> - if (!vma || !vma_migratable(vma))
> + if (!vma || pp->addr < vma->vm_start || !vma_migratable(vma))
> goto set_status;
>
> page = follow_page(vma, pp->addr, FOLL_GET);
> @@ -1005,7 +1005,7 @@ static void do_pages_stat_array(struct mm_struct *mm, unsigned long nr_pages,
> int err = -EFAULT;
>
> vma = find_vma(mm, addr);
> - if (!vma)
> + if (!vma || addr < vma->vm_start)
> goto set_status;
>
> page = follow_page(vma, addr, 0);
> --
> Gleb.
Looks good to me.
Revewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
--
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] 4+ messages in thread
end of thread, other threads:[~2010-10-22 2:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-19 10:15 [PATCH] fix error reporting in move_pages syscall Gleb Natapov
2010-10-21 18:27 ` Gleb Natapov
2010-10-21 18:55 ` Christoph Lameter
2010-10-22 2:12 ` KOSAKI Motohiro
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).