[CRIU] [PATCH] restore: Use in_vma_area helper in restore_priv_vma_content

Pavel Emelyanov xemul at parallels.com
Mon Mar 25 07:21:33 EDT 2013


On 03/25/2013 03:18 PM, Cyrill Gorcunov wrote:
> Because a sequence of VMAs is not obligated to not have
> holes inbetween, plain vma.end check is not enough, use
> in_vma_area instead to make sure that page addres we're
> using to restore page contents do belong to particular
> vma.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  cr-restore.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/cr-restore.c b/cr-restore.c
> index 13273c1..ae66668 100644
> --- a/cr-restore.c
> +++ b/cr-restore.c
> @@ -301,7 +301,7 @@ static int restore_priv_vma_content(pid_t pid)
>  			unsigned char buf[PAGE_SIZE];
>  			void *p;
>  
> -			while (va >= vma->vma.end) {
> +			while (!(in_vma_area(vma, va))) {

This will lead to total crap, as val _below_ vma will exit from this
while right at once and will result in negative off and other shit.

>  				if (vma->list.next == &rst_vmas.h)
>  					goto err_addr;
>  				vma = list_entry(vma->list.next, struct vma_area, list);
> 




More information about the CRIU mailing list