[CRIU] [PATCH 6/5] vdso: x86 -- Make sure the mark version matches

Cyrill Gorcunov gorcunov at gmail.com
Tue Jun 17 05:28:18 PDT 2014


On Tue, Jun 17, 2014 at 04:16:50PM +0400, Pavel Emelyanov wrote:
> On 06/17/2014 11:06 AM, Cyrill Gorcunov wrote:
> > On Tue, Jun 17, 2014 at 10:48:10AM +0400, Pavel Emelyanov wrote:
> >>>> If the signature is v2 one, then version _must_ be 2 here, otherwise
> >>>> we should abort the dump. Objections?
> >>>
> >>> I think so. Mind if I prepare patch on top of the series? The check
> >>> better should be done on a caller side thus patch will not be oneliner.
> >>> .
> >>>
> >>
> >> OK
> > 
> > Attached.
> > 
> 
> > @@ -331,6 +331,14 @@ static int parasite_check_vdso_mark(struct parasite_vdso_vma_entry *args)
> >  	struct vdso_mark *m = (void *)args->start;
> >  
> >  	if (is_vdso_mark(m)) {
> > +		/*
> > +		 * Make sure we don't meet some corrupted entry
> > +		 * where signature matches but verions is not!
> > +		 */
> > +		if (m->version != VDSO_MARK_CUR_VERSION) {
> 
> What if m->signature == <the-old-one>? Will we check the garbage
> for being VDSO_MARK_CUR_VERSION?

No, look how we check

static inline void vdso_put_mark(void *where, unsigned long proxy_vdso_addr, unsigned long proxy_vvar_addr)
{
	struct vdso_mark *m = where;

	m->signature		= VDSO_MARK_SIGNATURE_V2;
	m->proxy_vdso_addr	= proxy_vdso_addr;
	m->version		= VDSO_MARK_CUR_VERSION;
	m->proxy_vvar_addr	= proxy_vvar_addr;
}

static inline bool is_vdso_mark(void *addr)
{
	struct vdso_mark *m = addr;

	if (m->signature == VDSO_MARK_SIGNATURE_V2) {
		/*
		 * New format
		 */
		return true;
	} else if (m->signature == VDSO_MARK_SIGNATURE) {
		/*
		 * Old format -- simply extend the mark up
		 * to the version we support.
		 */
-->		vdso_put_mark(m, m->proxy_vdso_addr, VVAR_BAD_ADDR);

		we convert old mark into a new format

		return true;
	}
	return false;
}


> 
> > +			pr_err("vdso: Mark version mismatch!\n");
> > +			return -EINVAL;
> > +		}
> >  		args->is_marked = 1;
> >  		args->proxy_vdso_addr = m->proxy_vdso_addr;
> >  		args->proxy_vvar_addr = m->proxy_vvar_addr;
> 
> 

	Cyrill


More information about the CRIU mailing list