Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 8d45ab90 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Gerrit - the friendly Code Review server
Browse files

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.

Author: Peter Zijlstra (Intel) <peterz@infradead.org>
Reported-by: default avatarAlexei Starovoitov <alexei.starovoitov@gmail.com>
Tested-by: default avatarAlexei Starovoitov <ast@kernel.org>
Tested-by: default avatarDavid Carrillo-Cisneros <davidcc@google.com>
Signed-off-by: default avatarPeter 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")
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Git-commit: 451d24d1e5f40bad000fa9abe36ddb16fc9928cb
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


[pfay@codeaurora.org: apply the event->oncpu validity check from
  from the patch. Other code from the patch calls routines
  not yet in 4.4 so omit that part of patch. This code fixes
  segfault crashes during reboot where the event->oncpu value is -1.
Change-Id: I040f0af2030e53ac3329e4b3a1bbcd37f080cdcf
Signed-off-by: default avatarPatrick Fay <pfay@codeaurora.org>
parent 64b73bc1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment