[CRIU] [PATCH 5/5] vdso: x86 -- Add handling of vvar zones

Pavel Emelyanov xemul at parallels.com
Tue Jun 10 08:51:26 PDT 2014


On 06/06/2014 06:07 PM, Cyrill Gorcunov wrote:

> @@ -261,44 +262,83 @@ int vdso_remap(char *who, unsigned long from, unsigned long to, size_t size)
>  	return 0;
>  }
>  
> -int vdso_proxify(char *who, struct vdso_symtable *sym_rt, VmaEntry *vma, unsigned long vdso_rt_parked_at)
> +int vdso_proxify(char *who, struct vdso_symtable *sym_rt,
> +		 VmaEntry *vdso_vma, VmaEntry *vvar_vma,
> +		 unsigned long vdso_rt_parked_at)
>  {
>  	struct vdso_symtable s = VDSO_SYMTABLE_INIT;
> -	size_t size = vma_entry_len(vma);

This remove is a cleanup effectively. Plz, keep this variable.

> -	bool remap_rt = true;
> +	bool remap_rt = false;

Oh, sh... This drastically changes the logic below, doesn't it? :)

> +
> +	/*
> +	 * vDSO mark overwrites Elf program header of proxy vDSO thus
> +	 * it must never ever be greater in size.
> +	 */
> +	BUILD_BUG_ON(sizeof(struct vdso_mark) > sizeof(Elf64_Phdr));
>  
>  	/*
>  	 * Find symbols in dumpee vdso.
>  	 */
> -	if (vdso_fill_symtable((void *)vma->start, size, &s))
> +	if (vdso_fill_symtable((void *)vdso_vma->start, vma_entry_len(vdso_vma), &s))
>  		return -1;
>  
> -	if (size == vdso_vma_size(sym_rt)) {
> -		int i;
> +	/*
> +	 * Try to figure out if the vDSO in image has the same symbols
> +	 * as run time vDSO, if yes we might try to reuse runtime vDSO
> +	 * instead of one in image.
> +	 *
> +	 * In case if VVAR area is present at least it must have same
> +	 * size as dumped one for inplace remap.
> +	 */

> @@ -138,8 +138,12 @@ static int parse_vmflags(char *buf, struct vma_area *vma_area)
>  			vma_area->e->madv |= (1ul << MADV_NOHUGEPAGE);
>  
>  		/* vmsplice doesn't work for VM_IO and VM_PFNMAP mappings. */
> -		if (_vmflag_match(tok, "io") || _vmflag_match(tok, "pf"))
> -			vma_area->e->status |= VMA_UNSUPP;
> +		if (_vmflag_match(tok, "io") || _vmflag_match(tok, "pf")) {
> +#ifdef CONFIG_VDSO
> +			if (!vma_area_is(vma_area, VMA_AREA_VVAR))

Some comment here would be nice. Is vvar area marked with _either_ io _or_ pf?

> +#endif
> +				vma_area->e->status |= VMA_UNSUPP;
> +		}
>  
>  		/*
>  		 * Anything else is just ignored.


More information about the CRIU mailing list