OpenVZ Forum


Home » Mailing lists » Devel » [PATCH 00/10] Task Containers(V11): Introduction
Re: [PATCH 02/10] Task Containers(V11): Add tasks file interface [message #15201 is a reply to message #15192] Fri, 20 July 2007 20:20 Go to previous messageGo to previous message
James Morris is currently offline  James Morris
Messages: 10
Registered: March 2006
Junior Member
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>
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [Fwd: [2.6.22] negative time jump]
Next Topic: [PATCH] Add CTL_PROC back
Goto Forum:
  


Current Time: Sat Aug 30 15:11:36 GMT 2025

Total time taken to generate the page: 0.11175 seconds