From: Oleg Nesterov <oleg@tv-sign.ru>
To: Balbir Singh <balbir@in.ibm.com>
Cc: Andrew Morton <akpm@osdl.org>,
Shailabh Nagar <nagar@watson.ibm.com>, Jay Lan <jlan@sgi.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/6] fill_tgid: fix task_struct leak and possible oops
Date: Mon, 30 Oct 2006 23:34:18 +0300 [thread overview]
Message-ID: <20061030203418.GA677@oleg> (raw)
In-Reply-To: <45460302.4080904@in.ibm.com>
On 10/30, Balbir Singh wrote:
>
> Oleg Nesterov wrote:
>
> > 2. release_task(first) can happen after fill_tgid() drops tasklist_lock,
> > it is unsafe to dereference first->signal.
> >
>
> But, we have a reference to first via get_task_struct(). release_task()
> would do just a put_task_struct(). Am I missing something?
No, release_task() will reap the task. tsk->usage protects only task_struct
itself (more precisely, it protects against __put_task_struct()). And please
note that release_task()->__exit_signal() sets tsk->signal = NULL.
QUESTION: taskstats_exit_alloc() does kfree(kmem_cache_alloc()), is it OK?
Yes, it works, but is it good? The comment says:
* @objp: pointer returned by kmalloc.
Another question,
do_exit()
taskstats_exit_alloc()
...
taskstats_exit_send()
taskstats_exit_free()
What is the point? Why can't we have taskstats_exit() which does alloc+send+free
itself? This looks like unnecessary complication to me.
>From taskstats_exit_alloc:
/*
* This is the cpu on which the task is exiting currently and will
* be the one for which the exit event is sent, even if the cpu
* on which this function is running changes later.
*/
Why do we record current cpu exactly here? This task probably changed its
CPU many times since it entered sys_exit(), so what is the problem if it
will change CPU again before taskstats_exit_send() ?
Oleg.
prev parent reply other threads:[~2006-10-30 20:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-26 23:20 [PATCH 1/6] fill_tgid: fix task_struct leak and possible oops Oleg Nesterov
2006-10-30 13:49 ` Balbir Singh
2006-10-30 20:34 ` Oleg Nesterov [this message]
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=20061030203418.GA677@oleg \
--to=oleg@tv-sign.ru \
--cc=akpm@osdl.org \
--cc=balbir@in.ibm.com \
--cc=jlan@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nagar@watson.ibm.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