[1/6] Skip adding PROT_READ flag

Submitted by Abhishek Dubey on July 25, 2019, 1:13 a.m.

Details

Message ID 1564017190-7947-1-git-send-email-dubeyabhishek777@gmail.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Abhishek Dubey July 25, 2019, 1:13 a.m.
skip adding PROT_READ protection to the regions lacking
it for new pre-dump implementation

Signed-off-by: Abhishek Dubey <dubeyabhishek777@gmail.com>
---
 criu/mem.c | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

Patch hide | download patch | download mbox

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;

Comments

Andrey Vagin July 30, 2019, 4:35 a.m.
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@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
>
Abhishek Dubey Aug. 1, 2019, 5:49 a.m.
On 30/07/19 10:05 AM, Andrei Vagin wrote:
> 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.

Sure! I will be more descriptive in commit message.

I will cover detailed working of new implementation and process_vm_readv 
in cover letter.

Can the commit message point to content of cover letter?

>
>> Signed-off-by: Abhishek Dubey <dubeyabhishek777@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
>>
Dmitry Safonov Aug. 1, 2019, 1:21 p.m.
On 8/1/19 6:49 AM, abhishek dubey wrote:
> On 30/07/19 10:05 AM, Andrei Vagin wrote:
>> You need to describe why we need this changes. Nobody knows this new
>> pre-dump implementation yet.
> 
> Sure! I will be more descriptive in commit message.
> 
> I will cover detailed working of new implementation and process_vm_readv
> in cover letter.
> 
> Can the commit message point to content of cover letter?

No, cover-letter won't go into `git log` history, contrary to a merge
commit.

But copy'n'paste from cover letter some overall information into a patch
in the series is fine, as long as it does justify/describe something
happening in the commit itself.

Thanks,
          Dmitry