[cgmanager-devel] getTasks method

Stéphane Graber stgraber at ubuntu.com
Wed Jan 15 22:10:36 UTC 2014

On Wed, Jan 15, 2014 at 03:21:28PM -0600, Serge Hallyn wrote:
> One method which somehow never made it into my design is nrtasks, to
> return the list of tasks in the container.
> For the non-scm, same-pidns version, this could return a dbus array
> of int32s.  For the scm version, I only see two possibilities.  The
> potentially insecure one involves sending an fd for the open tasks
> file over SCM.  The client can then read the file, which should have
> pids translated to the client's pidns.

Are you sure this would work?

I quickly tried in a container doing:
 echo 1 > /sys/fs/cgroup/devices/tasks

Then in the same container in a python shell:
 import os
 os.open("/sys/fs/cgroup/devices/tasks", os.O_RDONLY)

And finally from outside the container:
 cat /proc/<pid of python shell>/fd/3

Which didn't give me the translated PID of PID 1 but instead a whole ton
of completely unrelated entries (no idea why...).

> The other possibility, which I'll go with unless I hear better ideas,
> is to send back to the client (which is the proxy) (1) an integer n saying
> how many tasks there are, followed by n scm_creds to send the pids,
> which will be translated en route by the kernel.
> Any other ideas?
> thanks,
> -serge
> _______________________________________________
> cgmanager-devel mailing list
> cgmanager-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/cgmanager-devel

Stéphane Graber
Ubuntu developer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/cgmanager-devel/attachments/20140115/06ef2b79/attachment.pgp>

More information about the cgmanager-devel mailing list