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]
Message-ID: <1302511465.29423.13.camel@minggr.sh.intel.com>
Date:	Mon, 11 Apr 2011 16:44:25 +0800
From:	Lin Ming <ming.m.lin@...el.com>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc:	Oleg Nesterov <oleg@...hat.com>, Jiri Olsa <jolsa@...hat.com>,
	Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
	Stephane Eranian <eranian@...gle.com>
Subject: Re: [RFC][PATCH 5/9] perf: Simplify and fix
 __perf_install_in_context

On Sun, 2011-04-10 at 10:13 +0200, Peter Zijlstra wrote:
> On Sat, 2011-04-09 at 21:17 +0200, Peter Zijlstra wrote:
> > +       if (task_ctx) {
> > +               task_ctx_sched_out(task_ctx);
> > +               /*
> > +                * If the context we're installing events in is not the
> > +                * active task_ctx, flip them.
> > +                */

In which case will this happen?

For task event, we have:

perf_install_in_context
   task_function_call(task, __perf_install_in_context, event)
      __perf_install_in_context

Doesn't this ensure that the context we're installing events is same
with the active task_ctx?

Lin Ming

> > +               if (ctx->task && task_ctx != ctx) {
> > +                       raw_spin_unlock(&cpuctx->ctx.lock);
> > +                       raw_spin_lock(&ctx->lock);
> > +                       cpuctx->task_ctx = task_ctx = ctx;
> > +               }
> > +               task = task_ctx->task;
> > +       } 
> 
> That is actually buggy, it should read something like:
> 
> 	if (task_ctx)
> 		task_ctx_sched_out(task_ctx);
> 
> 	if (ctx->task && task_ctx != ctx) {
> 		raw_spin_unlock(&task_ctx->lock);
> 		raw_spin_lock(&ctx->lock);
> 		cpuctx->task_ctx = task_ctx = ctx;
> 	}
> 
> 	if (task_ctx)
> 		task = task_ctx->task;
> 
> Aside from the trivial locking bug fixed, the previous version wouldn't
> actually deal with installing a task_ctx where there was none before.
> --
> 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/


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