Re: perf: NULL ptr deref in perf_event_context_sched_in

From: Peter Zijlstra
Date: Wed Sep 10 2014 - 06:03:13 EST


On Tue, Sep 09, 2014 at 03:23:53PM -0400, Sasha Levin wrote:

> While fuzzing with trinity inside a KVM tools guest running the latest -next
> kernel, I've stumbled on the following spew:
>
> [ 1181.492212] BUG: unable to handle kernel NULL pointer dereference at 0000000000000040
> [ 1181.500717] IP: perf_event_context_sched_in (kernel/events/core.c:333 kernel/events/core.c:2575)

Oh joy:

static inline struct perf_cpu_context *
__get_cpu_context(struct perf_event_context *ctx)
{
return this_cpu_ptr(ctx->pmu->pmu_cpu_context);
}

For some reason our pmu::pmu_cpu_context per-cpu storage is gone. Now
how did that happen.... /me puzzled

Attachment: pgpONyq4mGWtp.pgp
Description: PGP signature