From: Peter Zijlstra <peterz@infradead.org>
To: Liming Wang <liming.wang@windriver.com>
Cc: Ingo Molnar <mingo@elte.hu>,
Frederic Weisbecker <fweisbec@gmail.com>,
Paul Mackerras <paulus@samba.org>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] perf_event: add check for group_list if the parent isn't counted
Date: Wed, 30 Dec 2009 13:28:45 +0100 [thread overview]
Message-ID: <1262176125.7135.207.camel@laptop> (raw)
In-Reply-To: <1262172487-13694-1-git-send-email-liming.wang@windriver.com>
On Wed, 2009-12-30 at 19:28 +0800, Liming Wang wrote:
> If the parent has no entry in group_list, child_ctx will not be
> allocated, which will lead dereference of a NULL child_ctx.
That changelog sucks.
Best I can make of it is that there is a race where the parent gets his
context instantiated and we manage to get the mutex before the other
thread manages to add the first event.
Then we observe parent_event_ctx but have an empty list.
Is that it?
In that case, would it not be better to change the if (inherited_all)
condition to if (inherited_all && child_ctx) ?
> Signed-off-by: Liming Wang <liming.wang@windriver.com>
> ---
> kernel/perf_event.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/perf_event.c b/kernel/perf_event.c
> index 5b987b4..3664c4b 100644
> --- a/kernel/perf_event.c
> +++ b/kernel/perf_event.c
> @@ -5126,6 +5126,8 @@ int perf_event_init_task(struct task_struct *child)
> */
> mutex_lock(&parent_ctx->mutex);
>
> + if (list_empty(&parent_ctx->group_list))
> + goto exit;
> /*
> * We dont have to disable NMIs - we are only looking at
> * the list, not manipulating it:
next prev parent reply other threads:[~2009-12-30 12:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-30 11:28 [PATCH 1/1] perf_event: add check for group_list if the parent isn't counted Liming Wang
2009-12-30 12:28 ` Peter Zijlstra [this message]
2009-12-30 14:36 ` Wang Liming
2009-12-30 15:08 ` Peter Zijlstra
2009-12-30 15:02 ` Wang Liming
2009-12-31 14:30 ` [tip:perf/urgent] perf: Fix NULL deref in inheritance code tip-bot for Peter Zijlstra
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=1262176125.7135.207.camel@laptop \
--to=peterz@infradead.org \
--cc=fweisbec@gmail.com \
--cc=liming.wang@windriver.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=tglx@linutronix.de \
/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