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: <20130327163156.GB8385@pd.tnic>
Date:	Wed, 27 Mar 2013 17:31:56 +0100
From:	Borislav Petkov <bp@...en8.de>
To:	Peter Zijlstra <peterz@...radead.org>, Jiri Olsa <jolsa@...hat.com>
Cc:	Namhyung Kim <namhyung@...nel.org>, Ingo Molnar <mingo@...nel.org>,
	Arnaldo Carvalho de Melo <acme@...radead.org>,
	lkml <linux-kernel@...r.kernel.org>,
	Stephane Eranian <eranian@...gle.com>,
	Namhyung Kim <namhyung.kim@....com>
Subject: Re: BUG: using smp_processor_id() in preemptible [00000000] code:
 asm/8267

On Wed, Mar 27, 2013 at 03:09:32PM +0100, Peter Zijlstra wrote:
> On Wed, 2013-03-27 at 10:49 +0100, Borislav Petkov wrote:
> > Ok, just for my own understanding: how do the events on the
> > ->task_ctx->event_list relate to the current cpu in this path? I mean,
> > we're on the task exit path here so is it possible to be rescheduled
> > somewhere else and the check in event_filter_match to become
> > meaningless?
> 
> Events can be per-cpu, so what could happen is that we'd send the exit
> notification to a cpu we're not actually running on (anymore).

Right, but we still have a window of preemption enabled:

		put_cpu_ptr(pmu->pmu_cpu_context);	<---|
     	}						    |
	if (task_event->task_ctx) {			    |
		preempt_disable_notrace();		<---|

between the two arrows above.

I don't know the code all that well to know whether a reschedule in that
window would make us, when looking at the current cpu when matching the
events, look stupid or not...

OTOH, I can understand jolsa's approach of declaring the events on
->task_ctx->event_list for belonging to this task only and that then we
just don't want to compare event->cpu to the current cpu we're running
on.

But in the end of the day, I'd like you guys to decide what is the right
thing to do here.

Btw, jolsa, as a simplification to your solution, you could simply do:

	if (task_event->task_ctx)
		list_for_each_entry_rcu(event, &ctx->event_list, event_entry)
			perf_event_task_output(event, task_event);

and avoid adding a 'match' argument.

Thanks.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
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