[CRIU] [PATCH] proc_parse: Borrow vmi iif there is file referenced

Pavel Emelyanov xemul at parallels.com
Thu Mar 6 00:59:00 PST 2014


On 03/06/2014 12:19 PM, Cyrill Gorcunov wrote:
> Otherwise we migh propagate previous vfi status
> to vmas which actually don't match.
> 
>  | (00.005471) 0x2b79227d6000-0x2b79227d8000 (8K) prot 0x5 flags 0x22 off 0 reg vdso ap  shmid: 0
>  | (00.005473) 0x2b79227d8000-0x2b79227da000 (8K) prot 0x3 flags 0x22 off 0 reg vdso ap  shmid: 0
>  | (00.005475) 0x2b79227f1000-0x2b79227f2000 (4K) prot 0x3 flags 0x22 off 0 reg vdso ap  shmid: 0
>  | (00.005476) 0x2b79227f2000-0x2b79227f4000 (8K) prot 0x3 flags 0x22 off 0 reg vdso ap  shmid: 0
> 
> Reported-by: Pavel Tikhomirov <snorcht at gmail.com>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  proc_parse.c | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/proc_parse.c b/proc_parse.c
> index 3a7b5ebd21eb..22248f5d6f18 100644
> --- a/proc_parse.c
> +++ b/proc_parse.c
> @@ -172,14 +172,16 @@ static int vma_get_mapfile(struct vma_area *vma, DIR *mfd,
>  	if (prev_vfi->vma && vfi_equal(vfi, prev_vfi)) {
>  		struct vma_area *prev = prev_vfi->vma;
>  
> -		pr_debug("vma %"PRIx64" borrows vfi from previous %"PRIx64"\n",
> -				vma->e->start, prev->e->start);
> -		vma->vm_file_fd = prev->vm_file_fd;
> -		if (prev->e->status & VMA_AREA_SOCKET)
> -			vma->e->status |= VMA_AREA_SOCKET | VMA_AREA_REGULAR;
> -		vma->file_borrowed = true;
> -
> -		return 0;
> +		if (prev->vm_file_fd >= 0) {

vm_file_fd is union with packet socket ID. Strictly speaking this
check is not correct as well.

> +			pr_debug("vma %"PRIx64" borrows vfi from previous %"PRIx64"\n",
> +				 vma->e->start, prev->e->start);
> +			vma->vm_file_fd = prev->vm_file_fd;
> +			if (prev->e->status & VMA_AREA_SOCKET)
> +				vma->e->status |= VMA_AREA_SOCKET | VMA_AREA_REGULAR;
> +			vma->file_borrowed = true;
> +
> +			return 0;
> +		}
>  	}
>  
>  	/* Figure out if it's file mapping */
> 




More information about the CRIU mailing list