lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 15 Jul 2014 11:31:08 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	Jiri Olsa <jolsa@...nel.org>, linux-kernel@...r.kernel.org,
	Alexander Yarygin <yarygin@...ux.vnet.ibm.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...nel.org>,
	Paul Mackerras <paulus@...ba.org>
Subject: Re: [PATCH 2/5] perf: Destroy event's children on task exit

On Tue, Jul 15, 2014 at 11:11:04AM +0200, Peter Zijlstra wrote:
> On Mon, Jul 14, 2014 at 10:18:54PM +0200, Jiri Olsa wrote:
> > On Mon, Jul 14, 2014 at 01:18:33PM +0200, Peter Zijlstra wrote:
> > > On Fri, Jul 11, 2014 at 01:56:19PM +0200, Jiri Olsa wrote:
> > > > From: Jiri Olsa <jolsa@...hat.com>

SNIP

> 
> > > I don't think this is correct, perf_event_init_context() can come in
> > > concurrently and the first place it runs into ->child_mutex is after its
> > > already allocated and created the (first) child event.
> > 
> > just noticed this.. I'm working on the other version we decide, but FWIW
> > there's also mutex_lock(&child_ctx->mutex); before removing the context,
> > that should protect it against perf_event_init_context call
> 
> Oh, more fail :-)
> 
> You have:
> 
>   perf_event::child_mutex
>     perf_event_context::mutex
> 
> The existing code has:
> 
>   perf_event_context::mutex
>     perf_event::child_context
> 
> See for example:
> 
>   perf_event_init_context()
>     mutex_lock(&parent_ctx->mutex)
>     inherit_task_group()
>       inherit_group()
>         inherit_event()
> 	  mutex_lock(&parent_event->child_mutex)
> 
> and
> 
>   perf_event_for_each()
>     mutex_lock(&ctx->mutex)
>     perf_event_for_each_child()
>       mutex_lock(&event->child_mutex)
> 
> So the patch creates an AB-BA deadlock.

ouch, right.. I'll try to come with other way

thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists