From: Pavel Emelyanov <xemul@openvz.org>
To: Andrew Morton <akpm@linux-foundation.org>,
Vinay Sridhar <vinay@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, libc-alpha@sourceware.org,
drepper@redhat.com, wli@holomorphy.com, sripathik@in.ibm.com,
"Eric W. Biederman" <ebiederm@xmission.com>
Subject: Re: [RFC] Per-thread getrusage
Date: Mon, 28 Jan 2008 12:57:37 +0300 [thread overview]
Message-ID: <479DA711.3080301@openvz.org> (raw)
In-Reply-To: <20080128014534.17630ddd.akpm@linux-foundation.org>
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
next prev parent reply other threads:[~2008-01-28 10:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-17 8:27 [RFC] Per-thread getrusage Vinay Sridhar
2008-01-17 15:42 ` Ulrich Drepper
2008-01-19 1:14 ` Roland McGrath
2008-01-19 1:14 ` [PATCH] RUSAGE_THREAD Roland McGrath
2008-01-19 6:21 ` Ulrich Drepper
2008-01-21 9:55 ` Christoph Hellwig
2008-01-26 7:23 ` Michael Kerrisk
2008-01-28 5:52 ` [RFC] Per-thread getrusage Andrew Morton
2008-01-28 7:48 ` Pavel Emelyanov
2008-01-28 9:10 ` Andrew Morton
2008-01-28 9:38 ` Pavel Emelyanov
2008-01-28 9:45 ` Andrew Morton
2008-01-28 9:57 ` Pavel Emelyanov [this message]
2008-01-28 20:43 ` Eric W. Biederman
2008-01-28 21:57 ` Andrew Morton
2008-01-29 8:17 ` Pavel Emelyanov
2008-01-29 8:29 ` Pavel Emelyanov
2008-01-28 8:24 ` Sripathi Kodi
2008-01-28 9:22 ` Andrew Morton
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=479DA711.3080301@openvz.org \
--to=xemul@openvz.org \
--cc=akpm@linux-foundation.org \
--cc=drepper@redhat.com \
--cc=ebiederm@xmission.com \
--cc=libc-alpha@sourceware.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sripathik@in.ibm.com \
--cc=vinay@linux.vnet.ibm.com \
--cc=wli@holomorphy.com \
/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