[CRIU] [PATCH 4/4] arch: x86 -- Add proxification of vDSO calls

Pavel Emelyanov xemul at parallels.com
Wed Apr 17 09:32:30 EDT 2013


On 04/17/2013 05:20 PM, Cyrill Gorcunov wrote:
> On Wed, Apr 17, 2013 at 05:06:13PM +0400, Pavel Emelyanov wrote:
>>> +	/*
>>> +	 * Proxify vdso content.
>>> +	 */
>>> +	if (vdso_proxy->proxify) {
>>> +		void *base_to, *base_from;
>>> +
>>> +		base_to = decode_pointer(vma_premmaped_start(&vdso_proxy->vma_to->vma));
>>> +		base_from = decode_pointer(vma_premmaped_start(&vdso_proxy->sym_from->vma));
>>> +
>>> +		/*
>>> +		 * Fill new vDSO with content of run-time vDSO
>>> +		 */
>>> +		pr_debug("vdso: Copy run-time contents %p -> %p\n",
>>> +			 (void *)vdso_proxy->sym_rt.vma_start, base_to);
>>> +
>>> +		memcpy(base_to, (void *)vdso_proxy->sym_rt.vma_start,
>>> +		       symtable_vma_size(&vdso_proxy->sym_rt));
>>> +
>>> +		if (arch_proxify_vdso(base_to, base_from,
>>> +				      &vdso_proxy->sym_rt,
>>> +				      &vdso_proxy->sym_dumpee))
>>> +			return -1;
>>
>> I don't get this. You put into task's VDSO address a VDSO-proxy with the memcpy above
>> and tune jump offsets with arch_proxify_vdso. Where is the new VDSO itself?
> 
> read_vmas
> 	...
> +		if (vma_entry_is(&vma->vma, VMA_AREA_VDSO)) {
> +			pr_debug("vdso: Got dumpee area %lx-%lx\n",
> +				 (long)vma->vma.start, (long)vma->vma.end);
> +
> +			vdso_proxy.sym_from = vma;
> +		}
> +
> 
> then
> 
> +	if (vdso_proxy.proxify) {
> +		if (vdso_proxy.sym_from) {
> +			struct vma_area *last;
> +			struct vma_area *vma;
> +
> +			ret = -1;
> +			vma = alloc_vma_area();
> +			if (!vma)
> +				goto out;
> +
> +			last = list_entry(rst_vmas.h.prev, struct vma_area, list);
> +			rst_vmas.nr++;
> +			list_add_tail(&vma->list, &rst_vmas.h);

> +                       vma->vma.start  = last->vma.end;
> +                       vma->vma.end    = vma->vma.start + symtable_vma_size(&vdso_proxy.sym_rt);
> +                       vma->vma.prot   = PROT_READ | PROT_EXEC;
> +                       vma->vma.flags  = MAP_PRIVATE | MAP_ANONYMOUS;
> +                       vma->vma.status = VMA_AREA_REGULAR | VMA_AREA_VDSO | VMA_ANON_PRIVATE;

Who will then make sure that real VDSO would be at that place?

> 	Cyrill
> .
> 




More information about the CRIU mailing list