fix error reporting in move_pages syscall
Subsystems (2)
PATCH 1/1 fix error reporting in move_pages syscall
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.
mm/migrate.c +2 -2
@@ -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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
ping?
Quoted 30 lines · Gleb Natapov
vma returned by
find_vmadoes 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 <[email protected]>mm/migrate.c +2
-3@@ -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.
Quoted 5 lines
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
Gleb.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines · Gleb Natapov
vma returned by
find_vmadoes not necessary include given address. If this happens code tries to follow page outside of any vma and returns ENOENT instead of EFAULT.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 28 lines
vma returned by
find_vmadoes 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 <[email protected]>mm/migrate.c +2
-3@@ -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 ); --
Quoted 1 line
Gleb.
Looks good to me.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>