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: <1285846921.2144.19.camel@laptop>
Date:	Thu, 30 Sep 2010 13:42:01 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Frederic Weisbecker <fweisbec@...il.com>
Cc:	Jason Wessel <jason.wessel@...driver.com>,
	Jiri Olsa <jolsa@...hat.com>,
	kgdb-bugreport@...ts.sourceforge.net, linux-kernel@...r.kernel.org
Subject: Re: kgdb segv in the latest tip due to perf ctx changes

On Sat, 2010-09-25 at 15:55 +0200, Frederic Weisbecker wrote:

> > Frederic, anything we can do about that?
> 
> 
> 
> Jason's patch is partially good, it just lacks one place to handle.
> Jiri, can you test that?
> 
> diff --git a/kernel/hw_breakpoint.c b/kernel/hw_breakpoint.c
> index d71a987..d727c58 100644
> --- a/kernel/hw_breakpoint.c
> +++ b/kernel/hw_breakpoint.c
> @@ -134,7 +134,7 @@ fetch_bp_busy_slots(struct bp_busy_slots *slots, struct perf_event *bp,
>  		    enum bp_type_idx type)
>  {
>  	int cpu = bp->cpu;
> -	struct task_struct *tsk = bp->ctx->task;
> +	struct task_struct *tsk = bp->ctx ? bp->ctx->task : NULL;
>  
>  	if (cpu >= 0) {
>  		slots->pinned = per_cpu(nr_cpu_bp_pinned[type], cpu);
> @@ -213,7 +213,7 @@ toggle_bp_slot(struct perf_event *bp, bool enable, enum bp_type_idx type,
>  	       int weight)
>  {
>  	int cpu = bp->cpu;
> -	struct task_struct *tsk = bp->ctx->task;
> +	struct task_struct *tsk = bp->ctx ? bp->ctx->task : NULL;
>  
>  	/* Pinned counter cpu profiling */
>  	if (!tsk) {

That's identical to writing *tsk = NULL;

You seem to be missing the detail that perf_event->ctx will _always_ be
NULL during pmu::event_init()


> > That'll probably screw over some accounting, not sure what tsk is used
> > for there.
> 
> 
> Nope it's ok. tsk is used to know if we are dealing with
> a task/cpu bound breakpoint or a cpu wide bound one.
> 
> If tsk ends up being NULL, it will think it's a cpu wide bound
> breakpoint, which it is in the case of kgdb breakpoints.

See above, there's currently no way to know that in pmu::event_init().

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