diff options
author | Mark Rutland <mark.rutland@arm.com> | 2014-11-05 16:11:44 +0000 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-11-16 09:45:46 +0100 |
commit | 226424eee809251ec23bd4b09d8efba09c10fc3c (patch) | |
tree | 76d8125c2b50cc5a89a3860d7d8cc9c70625a9c8 /arch/x86/kernel/cpu/bugs_64.c | |
parent | ce5686d4ed12158599d2042a6c8659254ed263ce (diff) | |
download | op-kernel-dev-226424eee809251ec23bd4b09d8efba09c10fc3c.zip op-kernel-dev-226424eee809251ec23bd4b09d8efba09c10fc3c.tar.gz |
perf: Fix corruption of sibling list with hotplug
When a CPU hotplugged out, we call perf_remove_from_context() (via
perf_event_exit_cpu()) to rip each CPU-bound event out of its PMU's cpu
context, but leave siblings grouped together. Freeing of these events is
left to the mercy of the usual refcounting.
When a CPU-bound event's refcount drops to zero we cross-call to
__perf_remove_from_context() to clean it up, detaching grouped siblings.
This works when the relevant CPU is online, but will fail if the CPU is
currently offline, and we won't detach the event from its siblings
before freeing the event, leaving the sibling list corrupt. If the
sibling list is later walked (e.g. because the CPU cam online again
before a remaining sibling's refcount drops to zero), we will walk the
now corrupted siblings list, potentially dereferencing garbage values.
Given that the events should never be scheduled again (as we removed
them from their context), we can simply detatch siblings when the CPU
goes down in the first place. If the CPU comes back online, the
redundant call to __perf_remove_from_context() is safe.
Reported-by: Drew Richardson <drew.richardson@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: vincent.weaver@maine.edu
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1415203904-25308-2-git-send-email-mark.rutland@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/cpu/bugs_64.c')
0 files changed, 0 insertions, 0 deletions