diff options
author | Nicolas Pitre <nicolas.pitre@linaro.org> | 2013-03-29 17:30:10 -0400 |
---|---|---|
committer | Andrey Konovalov <andrey.konovalov@linaro.org> | 2013-05-25 13:24:33 +0400 |
commit | 561a989c0884475cafa5b325663b02c72e214942 (patch) | |
tree | b0bb249a26a547f8d91d5eb11ac1dacc4d07bda9 /ipc | |
parent | fcdca1fe734d6d58771636873c1b292e6de13383 (diff) |
ARM: perf_event_cpu.c: fix memory corruption causing unpleasant effects
1) The memory obtained via alloc_percpu() is defined (and zeroed) only
for those CPUs in cpu_possible_mask. For example, it is wrong to
itterate using:
for (i = 0; i < NR_CPUS; i++)
per_cpu_ptr(cpu_pmus, i)->mpidr = -1;
This is guaranteed to corrupt memory for those CPU numbers not marked
possible during CPU enumeration.
2) In cpu_pmu_free_irq(), an occasional cpu_pmu->mpidr of -1 (meaning
uninitialized) was nevertheless passed to find_logical_cpu() which
ended up returning very creative CPU numbers. This was then used
with this line:
if (!cpumask_test_and_clear_cpu(cpu, &pmu->active_irqs))
This corrupted memory due to the pmu->active_irqs overflow, and
provided rather random condition results.
What made this bug even nastier is the fact that a slight change in code
placement due to compiler version, kernel config options or even added
debugging traces could totally change the bug symptom.
Signed-off-by: Nicolas Pitre <nico@linaro.org>
Diffstat (limited to 'ipc')
0 files changed, 0 insertions, 0 deletions