[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Line.LNX.4.64.0707201616240.9702@d.namei>
Date: Fri, 20 Jul 2007 16:20:10 -0400 (EDT)
From: James Morris <jmorris@...ei.org>
To: menage@...gle.com
cc: akpm@...ux-foundation.org, dev@...ru, xemul@...ru,
serue@...ibm.com, vatsa@...ibm.com, ebiederm@...ssion.com,
haveblue@...ibm.com, svaidy@...ux.vnet.ibm.com, balbir@...ibm.com,
pj@....com, ckrm-tech@...ts.sourceforge.net,
linux-kernel@...r.kernel.org, rohitseth@...gle.com,
mbligh@...gle.com, containers@...ts.osdl.org, devel@...nvz.org
Subject: Re: [PATCH 02/10] Task Containers(V11): Add tasks file interface
On Fri, 20 Jul 2007, menage@...gle.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@...ei.org>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists