[CRIU] [PATCH 8/9] creds: restore -- Implement per-thread restore of credentials

Cyrill Gorcunov gorcunov at gmail.com
Thu Dec 17 08:05:43 PST 2015


On Thu, Dec 17, 2015 at 08:56:35AM -0700, Tycho Andersen wrote:
> > +
> > +static int rst_prep_creds(pid_t pid, CoreEntry *core, unsigned long *creds_pos)
> > +{
> > +	size_t i;
> > +
> > +	/*
> > +	 * This is _really_ very old image
> > +	 * format where @thread_core were not
> > +	 * present. It means we don't have
> > +	 * creds either, just ignore and exit
> > +	 * early.
> > +	 */
> > +	if (unlikely(!core->thread_core)) {
> > +		*creds_pos = 0;
> > +		return 0;
> > +	}
> > +
> > +	*creds_pos = rst_mem_cpos(RM_PRIVATE);
> > +
> > +	/*
> > +	 * Old format: one Creds per task carried in own image file.
> > +	 */
> > +	if (!core->thread_core->creds)
> > +		return rst_prep_creds_from_img(pid);
> 
> I guess in this case we have to open the image once per thread, which
> we try to avoid doing in other places. However, since this is the
> "legacy" case, I think it's probably ok to just leave it like this.

Currently we have one image per task, so we open it this way, because
there can't be creds per thread images. Or oyu mean something else?

> On a similar note, the linked list with mem_pos_next seemed a little
> weird, but I don't have a better suggestion :(

I would love to make it less weird either :)


More information about the CRIU mailing list