From: James Morris <jmorris@namei.org>
To: menage@google.com
Cc: akpm@linux-foundation.org, dev@sw.ru, xemul@sw.ru,
serue@us.ibm.com, vatsa@in.ibm.com, ebiederm@xmission.com,
haveblue@us.ibm.com, svaidy@linux.vnet.ibm.com,
balbir@in.ibm.com, pj@sgi.com, ckrm-tech@lists.sourceforge.net,
linux-kernel@vger.kernel.org, rohitseth@google.com,
mbligh@google.com, containers@lists.osdl.org, devel@openvz.org
Subject: Re: [PATCH 02/10] Task Containers(V11): Add tasks file interface
Date: Fri, 20 Jul 2007 16:20:10 -0400 (EDT) [thread overview]
Message-ID: <Line.LNX.4.64.0707201616240.9702@d.namei> (raw)
In-Reply-To: <20070720191247.556709000@menage.corp.google.com>
On Fri, 20 Jul 2007, menage@google.com wrote:
> +/*
> + * Attach task with pid 'pid' to container 'cont'. Call with
> + * container_mutex, may take task_lock of task
> + */
> +static int attach_task_by_pid(struct container *cont, char *pidbuf)
> +{
> + pid_t pid;
> + struct task_struct *tsk;
> + int ret;
> +
> + if (sscanf(pidbuf, "%d", &pid) != 1)
> + return -EIO;
> +
> + if (pid) {
> + rcu_read_lock();
> + tsk = find_task_by_pid(pid);
> + if (!tsk || tsk->flags & PF_EXITING) {
> + rcu_read_unlock();
> + return -ESRCH;
> + }
> + get_task_struct(tsk);
> + rcu_read_unlock();
> +
> + if ((current->euid) && (current->euid != tsk->uid)
> + && (current->euid != tsk->suid)) {
> + put_task_struct(tsk);
> + return -EACCES;
I wonder if we should allow CAP_SYS_ADMIN to do this, too.
--
James Morris
<jmorris@namei.org>
next prev parent reply other threads:[~2007-07-20 20:20 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-20 18:31 [PATCH 00/10] Task Containers(V11): Introduction menage
2007-07-20 18:31 ` [PATCH 01/10] Task Containers(V11): Basic task container framework menage
2007-07-27 5:31 ` YAMAMOTO Takashi
2007-07-29 17:03 ` Paul Menage
2007-07-30 4:00 ` YAMAMOTO Takashi
2007-07-20 18:31 ` [PATCH 02/10] Task Containers(V11): Add tasks file interface menage
2007-07-20 20:20 ` James Morris [this message]
2007-07-20 21:25 ` Paul Menage
2007-07-20 18:31 ` [PATCH 03/10] Task Containers(V11): Add fork()/exit() hooks menage
2007-07-20 18:31 ` [PATCH 04/10] Task Containers(V11): Add container_clone() interface menage
2007-07-20 18:31 ` [PATCH 05/10] Task Containers(V11): Add procfs interface menage
2007-07-20 18:31 ` [PATCH 06/10] Task Containers(V11): Shared container subsystem group arrays menage
2007-07-20 18:31 ` [PATCH 07/10] Task Containers(V11): Automatic userspace notification of idle containers menage
2007-07-23 17:41 ` Serge E. Hallyn
2007-07-20 18:32 ` [PATCH 08/10] Task Containers(V11): Make cpusets a client of containers menage
2007-07-20 18:32 ` [PATCH 09/10] Task Containers(V11): Example CPU accounting subsystem menage
2007-07-20 18:32 ` [PATCH 10/10] Task Containers(V11): Simple task container debug info subsystem menage
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Line.LNX.4.64.0707201616240.9702@d.namei \
--to=jmorris@namei.org \
--cc=akpm@linux-foundation.org \
--cc=balbir@in.ibm.com \
--cc=ckrm-tech@lists.sourceforge.net \
--cc=containers@lists.osdl.org \
--cc=dev@sw.ru \
--cc=devel@openvz.org \
--cc=ebiederm@xmission.com \
--cc=haveblue@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@google.com \
--cc=menage@google.com \
--cc=pj@sgi.com \
--cc=rohitseth@google.com \
--cc=serue@us.ibm.com \
--cc=svaidy@linux.vnet.ibm.com \
--cc=vatsa@in.ibm.com \
--cc=xemul@sw.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox