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

Pavel Emelyanov xemul at parallels.com
Thu Mar 6 04:51:38 PST 2014


On 03/06/2014 01:36 PM, Cyrill Gorcunov wrote:
> On Thu, Mar 06, 2014 at 01:29:08PM +0400, Pavel Emelyanov wrote:
>>>
>>> Hmm, then I fail to how to implement such check without calling
>>> for vma->vm_file_fd = openat(). What else we can test there?
>>
>> That vma is _not_ packet socket.
> 
> Something like this?
> 


> +		if (prev->vm_file_fd >= 0 && !vma_area_is(prev, VMA_AREA_SOCKET)) {
> +			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;
> +		}

Hm... Can we do it like this

if (prev->vm_file_fd < 0)
	return 0;

Since for anonymous mappings dev:ino would be 0:0 (matching) and we don't
even need to try messing the map_files -- it will be absent for sure.

Thanks,
Pavel


More information about the CRIU mailing list