[CRIU] [PATCH 8/9] creds: restore -- Implement per-thread restore of credentials
Tycho Andersen
tycho.andersen at canonical.com
Thu Dec 17 08:07:59 PST 2015
On Thu, Dec 17, 2015 at 07:05:43PM +0300, Cyrill Gorcunov wrote:
> 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?
I was thinking of the case where a task has N threads, this means that
if you dump this task with old criu and restore it with a criu with
this patchset, it'll open the creds image for that task N times.
I don't think it's such a big deal though, so let's forget about it.
> > 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 :)
Yeah. Unfortunately I think this might be the least weird it can be
:)
Tycho
More information about the CRIU
mailing list