lkml.org 
[lkml]   [2008]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] Per-thread getrusage
Andrew Morton wrote:
> On Mon, 28 Jan 2008 12:38:17 +0300 Pavel Emelyanov <xemul@openvz.org> wrote:
>
>>> If the code was using find_task_by_vpid() then OK (I guess). But it is
>> Yup, find_task_by_vpid() will find the proper (i.e. in your namespace) task.
>>
>>> looking the tids up in the init_pid_ns. Which I assume means that if it's
>>> in a new namespace and is looking up a sibling thread it will simply fail?
>> If it looks in the init_pid_ns, then it can either fail or obtain a task
>> from different namespace. The find_task_by_pid_ns() was intended to be used
>> in proc mainly, to get tasks from the namespace pointed by the super-block
>> being explored.
>>
>> Please excuse my lamentable ignorance, but which code does such things with
>> init_pid_ns? I followed the 'per-thread rusage' thread and didn't find any.
>
> From: Vinay Sridhar <vinay@linux.vnet.ibm.com>
> To: linux-kernel@vger.kernel.org, libc-alpha@sourceware.org
> Cc: drepper@redhat.com, wli@holomorphy.com, akpm@linux-foundation.org, sripathik@in.ibm.com
> Subject: [RFC] Per-thread getrusage

Ouch. Thanks, I've missed that and looked just at the Roland's patch :(

> ...
> +asmlinkage long sys_thread_getrusage(int tid, struct rusage __user *ru)
> +{
> + struct task_struct *tsk;
> + tsk = find_task_by_pid(tid);
> + return getrusage(tsk, RUSAGE_THREAD, ru);
> +}

Well, the find_task_by_pid() is really wrong here.

Besides (just in case this system call is going to be developed further),
the tsk == NULL case is not checked inside the getrusage and may OOPS
even if the proper namespace is used.

Thanks,
Pavel



\
 
 \ /
  Last update: 2008-01-28 11:07    [W:0.096 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site