[CRIU] [PATCH 09/10] epoll: Ignore inaccessible targets

Cyrill Gorcunov gorcunov at gmail.com
Mon Mar 13 05:23:05 PDT 2017


On Mon, Mar 13, 2017 at 02:44:11PM +0300, Kirill Tkhai wrote:

Suppose nr_valid = 0

> > +
> > +		if (nr_valid != dinfo->efe.n_tfd) {
> > +			size_t i = 0;
> >  
> > -			if (pb_write_one(img_from_set(glob_imgset, CR_FD_EVENTPOLL_FILE),
> > -					 &dinfo->efe, PB_EVENTPOLL_FILE))
> > +			EventpollTfdEntry **tfd = xmalloc(sizeof(struct EventpollTfdEntry *) * nr_valid);
> 
> 
> > +			if (!tfd)
> >  				goto out;

We hit this

> > +
> > +			list_for_each_entry(te, &dinfo->ep_list, epl.node) {
> > +				if (te->epl.valid)
> > +					tfd[i++] = &te->epl.e;
> > +			}
> > +
> > +			xfree(dinfo->efe.tfd);
> > +			dinfo->efe.tfd = tfd;
> > +			dinfo->efe.n_tfd = nr_valid;
> >  		}
> > +
> > +		pr_info_eventpoll("Dumping ", &dinfo->efe);
> > +		if (pb_write_one(img_from_set(glob_imgset, CR_FD_EVENTPOLL_FILE),
> > +				 &dinfo->efe, PB_EVENTPOLL_FILE))
> 
> Have you checked that this works correct, when nr_valid == 0 and tfd == NULL?

We can't reach this point with nr_valid = 0

> 
> > +			goto out;
> >  	}
> >  
> >  	ret = 0;

And ret = -1 will be returned


More information about the CRIU mailing list