]> git.karo-electronics.de Git - linux-beck.git/commit
perf/core: Fix crash in perf_event_read()
authorPeter Zijlstra <peterz@infradead.org>
Tue, 31 Jan 2017 10:27:10 +0000 (11:27 +0100)
committerIngo Molnar <mingo@kernel.org>
Fri, 10 Feb 2017 08:04:50 +0000 (09:04 +0100)
commit451d24d1e5f40bad000fa9abe36ddb16fc9928cb
tree532b1fe208f3223a3b447f535f4a761f08c2527a
parent53e74a112ce5c1c9b6a6923bdd6612133625d579
perf/core: Fix crash in perf_event_read()

Alexei had his box explode because doing read() on a package
(rapl/uncore) event that isn't currently scheduled in ends up doing an
out-of-bounds load.

Rework the code to more explicitly deal with event->oncpu being -1.

Reported-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Tested-by: Alexei Starovoitov <ast@kernel.org>
Tested-by: David Carrillo-Cisneros <davidcc@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: eranian@google.com
Fixes: d6a2f9035bfc ("perf/core: Introduce PMU_EV_CAP_READ_ACTIVE_PKG")
Link: http://lkml.kernel.org/r/20170131102710.GL6515@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/events/core.c