[CRIU] [PATCH 1/6] Skip adding PROT_READ flag

Andrei Vagin avagin at gmail.com
Tue Jul 30 07:35:44 MSK 2019


On Thu, Jul 25, 2019 at 06:43:10AM +0530, Abhishek Dubey wrote:
> skip adding PROT_READ protection to the regions lacking
> it for new pre-dump implementation

You need to describe why we need this changes. Nobody knows this new
pre-dump implementation yet.

> 
> Signed-off-by: Abhishek Dubey <dubeyabhishek777 at gmail.com>
> ---
>  criu/mem.c | 30 +++++++++++++++++-------------
>  1 file changed, 17 insertions(+), 13 deletions(-)
> 
> diff --git a/criu/mem.c b/criu/mem.c
> index de66a62..a7e8d0b 100644
> --- a/criu/mem.c
> +++ b/criu/mem.c
> @@ -530,16 +530,18 @@ int parasite_dump_pages_seized(struct pstree_item *item,
>  	 * Afterwards -- reprotect memory back.
>  	 */
>  
> -	pargs->add_prot = PROT_READ;
> -	ret = compel_rpc_call_sync(PARASITE_CMD_MPROTECT_VMAS, ctl);
> -	if (ret) {
> -		pr_err("Can't dump unprotect vmas with parasite\n");
> -		return ret;
> -	}
> +	if (!mdc->pre_dump) {
> +		pargs->add_prot = PROT_READ;
> +		ret = compel_rpc_call_sync(PARASITE_CMD_MPROTECT_VMAS, ctl);
> +		if (ret) {
> +			pr_err("Can't dump unprotect vmas with parasite\n");
> +			return ret;
> +		}
>  
> -	if (fault_injected(FI_DUMP_PAGES)) {
> -		pr_err("fault: Dump VMA pages failure!\n");
> -		return -1;
> +		if (fault_injected(FI_DUMP_PAGES)) {
> +			pr_err("fault: Dump VMA pages failure!\n");
> +			return -1;
> +		}
>  	}
>  
>  	ret = __parasite_dump_pages_seized(item, pargs, vma_area_list, mdc, ctl);
> @@ -549,10 +551,12 @@ int parasite_dump_pages_seized(struct pstree_item *item,
>  		return ret;
>  	}
>  
> -	pargs->add_prot = 0;
> -	if (compel_rpc_call_sync(PARASITE_CMD_MPROTECT_VMAS, ctl)) {
> -		pr_err("Can't rollback unprotected vmas with parasite\n");
> -		ret = -1;
> +	if (!mdc->pre_dump) {
> +		pargs->add_prot = 0;
> +		if (compel_rpc_call_sync(PARASITE_CMD_MPROTECT_VMAS, ctl)) {
> +			pr_err("Can't rollback unprotected vmas with parasite\n");
> +			ret = -1;
> +		}
>  	}
>  
>  	return ret;
> -- 
> 2.7.4
> 


More information about the CRIU mailing list