[2/6] Skip generating iov for non PROT_READ region

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

Details

Message ID 1564017207-7996-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 iov-generation for regions not having PROT_READ,
since process_vm_readv syscall fail to process such regions

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

Patch hide | download patch | download mbox

diff --git a/criu/mem.c b/criu/mem.c
index a7e8d0b..5c13690 100644
--- a/criu/mem.c
+++ b/criu/mem.c
@@ -361,6 +361,12 @@  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 (pre_dump)
+			return 0;
+		has_parent = false;
+	}
+
 	if (vma_entry_is(vma->e, VMA_AREA_AIORING)) {
 		if (pre_dump)
 			return 0;

Comments

Pavel Emelianov July 30, 2019, 12:37 p.m.
On 7/25/19 4:13 AM, Abhishek Dubey wrote:
> skip iov-generation for regions not having PROT_READ,
> since process_vm_readv syscall fail to process such regions
> 
> Signed-off-by: Abhishek Dubey <dubeyabhishek777@gmail.com>
> ---
>  criu/mem.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/criu/mem.c b/criu/mem.c
> index a7e8d0b..5c13690 100644
> --- a/criu/mem.c
> +++ b/criu/mem.c
> @@ -361,6 +361,12 @@ 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 (pre_dump)
> +			return 0;
> +		has_parent = false;

Why setting this to false in this case?

> +	}
> +
>  	if (vma_entry_is(vma->e, VMA_AREA_AIORING)) {
>  		if (pre_dump)
>  			return 0;
>
Abhishek Dubey Aug. 2, 2019, 6:13 a.m.
On 30/07/19 6:07 PM, Pavel Emelianov wrote:
> On 7/25/19 4:13 AM, Abhishek Dubey wrote:
>> skip iov-generation for regions not having PROT_READ,
>> since process_vm_readv syscall fail to process such regions
>>
>> Signed-off-by: Abhishek Dubey <dubeyabhishek777@gmail.com>
>> ---
>>   criu/mem.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/criu/mem.c b/criu/mem.c
>> index a7e8d0b..5c13690 100644
>> --- a/criu/mem.c
>> +++ b/criu/mem.c
>> @@ -361,6 +361,12 @@ 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 (pre_dump)
>> +			return 0;
>> +		has_parent = false;
> Why setting this to false in this case?

Same function is used for generating iov for pre-dump and dump.

When a vma don't have PROT_READ flag set, such vma must not be listed, 
since process_vm_readv() syscall can't process

such mappings so they are skipped from adding in iovec.

When same function prepare iov for dump stage and a vma don't have 
PROT_READ flag, this iov was never drained in previous

pre-dump(s) (due to reason mentioned above), therefore setting the 
parent to false.

>
>> +	}
>> +
>>   	if (vma_entry_is(vma->e, VMA_AREA_AIORING)) {
>>   		if (pre_dump)
>>   			return 0;
>>
-Abhishek