Mark Rutland
226424eee8
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>
2014-11-16 09:45:46 +01:00
..
bpf
bpf: split eBPF out of NET
2014-10-27 19:09:59 -04:00
configs
debug
kdb: replace strnicmp with strncasecmp
2014-10-14 02:18:25 +02:00
events
perf: Fix corruption of sibling list with hotplug
2014-11-16 09:45:46 +01:00
gcov
gcov: add ARM64 to GCOV_PROFILE_ALL
2014-10-29 16:33:14 -07:00
irq
Merge branch 'for-3.18-consistent-ops' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
2014-10-15 07:48:18 +02:00
locking
Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
2014-10-13 15:51:40 +02:00
power
PM / Sleep: fix recovery during resuming from hibernation
2014-10-27 18:42:26 +01:00
printk
Merge branch 'for-3.18-consistent-ops' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
2014-10-15 07:48:18 +02:00
rcu
rcu: Make rcu_barrier() understand about missing rcuo kthreads
2014-10-28 13:24:13 -07:00
sched
sched/dl: Fix preemption checks
2014-10-28 10:46:10 +01:00
time
clockevents: Prevent shift out of bounds
2014-10-25 10:43:15 +02:00
trace
tracing/syscalls: Ignore numbers outside NR_syscalls' range
2014-10-30 20:58:38 -04:00
.gitignore
acct.c
acct: eliminate compile warning
2014-10-09 22:26:04 -04:00
async.c
kernel/async.c: switch to pr_foo()
2014-10-09 22:26:04 -04:00
audit.c
Merge git://git.infradead.org/users/eparis/audit
2014-10-19 16:25:56 -07:00
audit.h
audit: reduce scope of audit_log_fcaps
2014-09-23 16:37:51 -04:00
audit_tree.c
audit: rename audit_log_remove_rule to disambiguate for trees
2014-10-10 15:30:25 -04:00
audit_watch.c
audit: invalid op= values for rules
2014-09-23 16:37:53 -04:00
auditfilter.c
Merge git://git.infradead.org/users/eparis/audit
2014-10-19 16:25:56 -07:00
auditsc.c
Merge git://git.infradead.org/users/eparis/audit
2014-10-19 16:25:56 -07:00
backtracetest.c
bounds.c
capability.c
cgroup.c
Merge branch 'for-3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
2014-10-10 07:26:02 -04:00
cgroup_freezer.c
compat.c
configs.c
context_tracking.c
sched: stop the unbound recursion in preempt_schedule_context()
2014-10-28 10:46:05 +01:00
cpu.c
rcu: More on deadlock between CPU hotplug and expedited grace periods
2014-10-23 07:51:17 -07:00
cpu_pm.c
cpuset.c
Merge branch 'for-3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
2014-10-10 07:24:40 -04:00
crash_dump.c
cred.c
delayacct.c
dma.c
elfcore.c
exec_domain.c
exit.c
Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
2014-10-13 16:23:15 +02:00
extable.c
fork.c
Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
2014-10-13 16:23:15 +02:00
freezer.c
freezer: remove obsolete comments in __thaw_task()
2014-10-21 23:44:20 +02:00
futex.c
futex: Fix a race condition between REQUEUE_PI and task death
2014-10-26 16:16:18 +01:00
futex_compat.c
groups.c
hung_task.c
irq_work.c
Merge branch 'for-3.18-consistent-ops' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
2014-10-15 07:48:18 +02:00
jump_label.c
kallsyms.c
kernel/kallsyms.c: use __seq_open_private()
2014-10-14 02:18:16 +02:00
kcmp.c
kcmp: fix standard comparison bug
2014-09-10 15:42:12 -07:00
Kconfig.freezer
Kconfig.hz
Kconfig.locks
Kconfig.preempt
kexec.c
kexec: remove the unused function parameter
2014-10-14 02:18:21 +02:00
kmod.c
kernel/kmod: fix use-after-free of the sub_info structure
2014-10-29 16:33:14 -07:00
kprobes.c
ksysfs.c
kthread.c
kernel/kthread.c: partial revert of 81c98869fa ("kthread: ensure locality of task_struct allocations")
2014-10-09 22:25:51 -04:00
latencytop.c
Makefile
bpf: split eBPF out of NET
2014-10-27 19:09:59 -04:00
module-internal.h
module.c
A single panic fix for a rare race, stable CC'd.
2014-10-18 10:24:26 -07:00
module_signing.c
notifier.c
nsproxy.c
padata.c
panic.c
params.c
kernel/param: consolidate __{start,stop}___param[] in <linux/moduleparam.h>
2014-10-14 02:18:28 +02:00
pid.c
pid_namespace.c
profile.c
ptrace.c
range.c
reboot.c
kernel: add support for kernel restart handler call chain
2014-09-26 00:00:06 -07:00
relay.c
res_counter.c
resource.c
x86: optimize resource lookups for ioremap
2014-10-14 02:18:22 +02:00
seccomp.c
Merge branch 'x86-seccomp-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
2014-10-14 02:27:06 +02:00
signal.c
smp.c
Merge branch 'for-3.18-consistent-ops' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
2014-10-15 07:48:18 +02:00
smpboot.c
smpboot.h
softirq.c
Merge branch 'for-3.18-consistent-ops' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
2014-10-15 07:48:18 +02:00
stacktrace.c
stop_machine.c
sys.c
Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
2014-10-13 16:23:15 +02:00
sys_ni.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
2014-10-08 21:40:54 -04:00
sysctl.c
sched/fair: Fix division by zero sysctl_numa_balancing_scan_size
2014-10-28 10:46:04 +01:00
sysctl_binary.c
dmaengine-3.17
2014-10-07 20:39:25 -04:00
system_certificates.S
system_keyring.c
task_work.c
taskstats.c
test_kprobes.c
torture.c
torture: Address race in module cleanup
2014-09-16 13:41:06 -07:00
tracepoint.c
tsacct.c
uid16.c
up.c
user-return-notifier.c
user.c
user_namespace.c
utsname.c
utsname_sysctl.c
watchdog.c
Merge branch 'for-3.18-consistent-ops' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
2014-10-15 07:48:18 +02:00
workqueue.c
workqueue: Use cond_resched_rcu_qs macro
2014-10-06 05:58:26 -07:00
workqueue_internal.h