[CRIU] [PATCH 3/4] arch: x86 -- Add dumping of vDSO layout

Cyrill Gorcunov gorcunov at openvz.org
Tue Apr 16 06:17:39 EDT 2013


On Tue, Apr 16, 2013 at 02:12:11PM +0400, Andrew Vagin wrote:
> > +
> > +typedef struct {
> > +	u16	movabs;
> > +	u64	imm64;
> > +	u16	jmp_rax;
> > +	u32	guards;
> > +} __packed jmp_t;
> > +
> > +int arch_proxify_vdso(void *base_to, void *base_from, symtable_t *to, symtable_t *from)
> 
> I think this function should be in the next patch
> 
> > +{
> > +	jmp_t jmp = {
> > +		.movabs		= 0xb848,
> > +		.jmp_rax	= 0xe0ff,
> > +		.guards		= 0xcccccccc,
> > +	};
> > +	unsigned int i;
> > +
> > +	/*
> > +	 * We support forward jumps only, for simplicity
> > +	 * reason, thus the caller must provide us validated
> > +	 * data only.
> > +	 */
> > +	for (i = 0; i < ARRAY_SIZE(to->sym); i++) {
> > +		if (arch_is_vdso_symbol_empty(&from->sym[i]))
> > +			continue;
> > +
> > +		pr_debug("jmp: %lx/%lx -> %lx/%lx\n",
> > +			 (unsigned long)base_from, from->sym[i].offset,
> > +			 (unsigned long)base_to, to->sym[i].offset);
> > +
> > +		jmp.imm64 = (unsigned long)base_to + to->sym[i].offset;
> > +
> > +		memcpy((void *)(base_from + from->sym[i].offset), &jmp, sizeof(jmp));
> > +	}
> > +
> > +	return 0;
> > +}

sigh, indeed, it sneaked in while I've been merging a number of small commits
to a patch series. sorry about that.


More information about the CRIU mailing list