[CRIU] [PATCH] restore: Use in_vma_area helper in restore_priv_vma_content
Andrew Vagin
avagin at parallels.com
Mon Mar 25 08:02:28 EDT 2013
On Mon, Mar 25, 2013 at 03:18:46PM +0400, 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 is correct, but I don't like it. The vma list should be sorted, so
the origin сondition is correct. We need to add a check, that va is in
vma, right after this loop.
> if (vma->list.next == &rst_vmas.h)
> goto err_addr;
> vma = list_entry(vma->list.next, struct vma_area, list);
> --
> 1.8.1.4
>
More information about the CRIU
mailing list