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
| ||
|
Date: Tue, 26 Mar 2013 19:34:52 +0100 From: Borislav Petkov <bp@...en8.de> To: Ingo Molnar <mingo@...nel.org>, Peter Zijlstra <peterz@...radead.org>, Arnaldo Carvalho de Melo <acme@...radead.org>, lkml <linux-kernel@...r.kernel.org>, Stephane Eranian <eranian@...gle.com> Cc: Namhyung Kim <namhyung.kim@....com>, Jiri Olsa <jolsa@...hat.com>, Peter Zijlstra <a.p.zijlstra@...llo.nl> Subject: Re: BUG: using smp_processor_id() in preemptible [00000000] code: asm/8267 On Sun, Mar 24, 2013 at 04:59:24PM +0100, Borislav Petkov wrote: > On Sun, Mar 24, 2013 at 12:55:56PM +0100, Borislav Petkov wrote: > > Hi, > > > > so I was tracing a small .c program like so: > > > > $ ./perf record ~/test/asm > > > > and here's what got spewed in dmesg. Kernel is plain -rc4. Any pending > > fixes in tip I should try? > > > > [ 3700.194208] BUG: using smp_processor_id() in preemptible [00000000] code: asm/8333 > > [ 3700.194226] caller is perf_event_task_ctx+0x55/0x140 > > Ok, here's the call stack I was able to reconstruct: > > perf_event_exit_task() > |->perf_event_exit_task_context() > |-> perf_event_task() > |-> perf_event_task_event() > |-> perf_event_task_ctx() > |-> perf_event_task_match() > |-> event_filter_match() > |-> smp_processor_id() -> debug_smp_processor_id() Ok, jolsa just rootcaused it: It is caused by d610d98b5de6860feb21539726e9af7c9094151c calling perf_event_task_ctx() outside of the preempt-safe protection. There's a straightforward fix below, what to people think? -- diff --git a/kernel/events/core.c b/kernel/events/core.c index 7b4a55d41efc..f3bb3384a106 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -4455,8 +4455,11 @@ static void perf_event_task_event(struct perf_task_event *task_event) next: put_cpu_ptr(pmu->pmu_cpu_context); } + + preempt_disable(); if (task_event->task_ctx) perf_event_task_ctx(task_event->task_ctx, task_event); + preempt_enable(); rcu_read_unlock(); } -- 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