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, 24 Jun 2014 12:39:36 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Jiri Olsa <jolsa@...nel.org>
Cc:	linux-kernel@...r.kernel.org, Jiri Olsa <jolsa@...hat.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
	David Ahern <dsahern@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...nel.org>,
	Namhyung Kim <namhyung@...nel.org>,
	Paul Mackerras <paulus@...ba.org>
Subject: Re: [PATCH 2/3] perf: Do not allow optimized switch for non-cloned
 events

On Tue, Jun 24, 2014 at 10:20:25AM +0200, Jiri Olsa wrote:
> From: Jiri Olsa <jolsa@...hat.com>
> 
> The context check in perf_event_context_sched_out allows
> non-cloned context to be part of the optimized schedule
> out switch.
> 
> This could move non-cloned context into another workload
> child. Once this child exits, the context is closed and
> leaves all original (parent) events in closed state.
> 
> Any other new cloned event will have closed state and not
> measure anything. And probably causing other odd bugs.
> 
> Cc: Arnaldo Carvalho de Melo <acme@...nel.org>
> Cc: Corey Ashford <cjashfor@...ux.vnet.ibm.com>
> Cc: David Ahern <dsahern@...il.com>
> Cc: Frederic Weisbecker <fweisbec@...il.com>
> Cc: Ingo Molnar <mingo@...nel.org>
> Cc: Namhyung Kim <namhyung@...nel.org>
> Cc: Paul Mackerras <paulus@...ba.org>
> Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> ---
>  kernel/events/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index d968008..4e3618e 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -2319,7 +2319,7 @@ static void perf_event_context_sched_out(struct task_struct *task, int ctxn,
>  	next_parent = rcu_dereference(next_ctx->parent_ctx);
>  
>  	/* If neither context have a parent context; they cannot be clones. */
> -	if (!parent && !next_parent)
> +	if (!parent || !next_parent)
>  		goto unlock;
>  
>  	if (next_parent == ctx || next_ctx == parent || next_parent == parent) {

Ohh, nice, good catch!

Thanks
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ