Re: [PATCH] alpha: perf: fix out-of-bounds array access triggeredfrom raw event

From: Will Deacon
Date: Sun Oct 27 2013 - 10:39:20 EST


Matt,

On Tue, Sep 10, 2013 at 11:19:44AM +0100, Michael Cree wrote:
> On Tue, Sep 10, 2013 at 10:58:12AM +0100, Will Deacon wrote:
> > Vince's perf fuzzer uncovered the following issue on Alpha:
> >
> > Unable to handle kernel paging request at virtual address fffffbfe4e46a0e8
> > CPU 0 perf_fuzzer(1278): Oops 0
> > pc = [<fffffc000031fbc0>] ra = [<fffffc000031ff54>] ps = 0007 Not tainted
> > pc is at alpha_perf_event_set_period+0x60/0xf0
> > ra is at alpha_pmu_enable+0x1a4/0x1c0
> > v0 = 0000000000000000 t0 = 00000000000fffff t1 = fffffc007b3f5800
> > t2 = fffffbff275faa94 t3 = ffffffffc9b9bd89 t4 = fffffbfe4e46a098
> > t5 = 0000000000000020 t6 = fffffbfe4e46a0b8 t7 = fffffc007f4c8000
> > s0 = 0000000000000000 s1 = fffffc0001b0c018 s2 = fffffc0001b0c020
> > s3 = fffffc007b3f5800 s4 = 0000000000000001 s5 = ffffffffc9b9bd85
> > s6 = 0000000000000001
> > a0 = 0000000000000006 a1 = fffffc007b3f5908 a2 = fffffbfe4e46a098
> > a3 = 00000005000108c0 a4 = 0000000000000000 a5 = 0000000000000000
> > t8 = 0000000000000001 t9 = 0000000000000001 t10= 0000000027829f6f
> > t11= 0000000000000020 pv = fffffc000031fb60 at = fffffc0000950900
> > gp = fffffc0000940900 sp = fffffc007f4cbca8

[...]

> > This patch adds a new callback to alpha_pmu_t for validating the raw
> > event encoding with the Linux event types for the PMU, preventing the
> > out-of-bounds array access.
> >
> > Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
> > Cc: Michael Cree <mcree@xxxxxxxxxxxx>
> > Cc: Matt Turner <mattst88@xxxxxxxxx>
> > Signed-off-by: Will Deacon <will.deacon@xxxxxxx>
>
> Acked-by: Michael Cree <mcree@xxxxxxxxxxxx>

I just remembered about this patch whilst cleaning up some old git branches.
Please could you include it in the Alpha tree with a CC stable? Without it,
it's trivial to panic a perf-enabled Alpha kernel from userspace.

Cheers,

Will
--
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html