[CRIU] [PATCH 2/7] Skip generating iov for non PROT_READ region

Andrei Vagin avagin at gmail.com
Thu Aug 22 18:06:59 MSK 2019


On Wed, Aug 21, 2019 at 04:36:57AM +0530, Abhishek Dubey wrote:
> skip iov-generation corresponding to regions
> not having PROT_READ, since process_vm_readv
> syscall can't process them during pre-dumping
> in "read" mode.
> 
> Signed-off-by: Abhishek Dubey <dubeyabhishek777 at gmail.com>
> ---
>  criu/mem.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/criu/mem.c b/criu/mem.c
> index e19688d..740992d 100644
> --- a/criu/mem.c
> +++ b/criu/mem.c
> @@ -351,7 +351,7 @@ static int generate_vma_iovs(struct pstree_item *item, struct vma_area *vma,
>  			     struct page_pipe *pp, struct page_xfer *xfer,
>  			     struct parasite_dump_pages_args *args,
>  			     struct parasite_ctl *ctl, pmc_t *pmc,
> -			     bool has_parent, bool pre_dump)
> +			     bool has_parent, struct mem_dump_ctl *mdc)
>  {
>  	u64 off = 0;
>  	u64 *map;
> @@ -361,8 +361,15 @@ static int generate_vma_iovs(struct pstree_item *item, struct vma_area *vma,
>  				!vma_area_is(vma, VMA_ANON_SHARED))
>  		return 0;
>  
> +	if (!(vma->e->prot & PROT_READ)) {
> +		if (mdc->pre_dump == PRE_DUMP_READ)
> +			return 0;
> +		if (!mdc->pre_dump)
> +			has_parent = false;

What does this mean?

> +	}
> +
>  	if (vma_entry_is(vma->e, VMA_AREA_AIORING)) {
> -		if (pre_dump)
> +		if (mdc->pre_dump)
>  			return 0;
>  		has_parent = false;
>  	}
> @@ -474,7 +481,7 @@ static int __parasite_dump_pages_seized(struct pstree_item *item,
>  	has_parent = !!xfer.parent && !possible_pid_reuse;
>  	list_for_each_entry(vma_area, &vma_area_list->h, list) {
>  		ret = generate_vma_iovs(item, vma_area, pp, &xfer, args, ctl,
> -					&pmc, has_parent, mdc->pre_dump);
> +					&pmc, has_parent, mdc);
>  		if (ret < 0)
>  			goto out_xfer;
>  	}
> -- 
> 2.7.4
> 


More information about the CRIU mailing list