perf: Fix event->ctx locking 93/160893/1
authorPeter Zijlstra <peterz@infradead.org>
Fri, 23 Jan 2015 11:24:14 +0000 (12:24 +0100)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 20 Nov 2017 10:28:26 +0000 (19:28 +0900)
commitf224edf0914bb31605b55473d3bf79f88df480bc
tree506b70af171eacf12a4060ad602021ef21820a61
parent81021a05356917d0eaacc43aafb53aa55bf91217
perf: Fix event->ctx locking

commit f63a8daa5812afef4f06c962351687e1ff9ccb2b upstream.

There have been a few reported issues wrt. the lack of locking around
changing event->ctx. This patch tries to address those.

It avoids the whole rwsem thing; and while it appears to work, please
give it some thought in review.

What I did fail at is sensible runtime checks on the use of
event->ctx, the RCU use makes it very hard.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/20150123125834.209535886@infradead.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
[sw0312.kim: backport the commit 18163dd15627 from linux-3.16.y to fix CVE-2016-6787 and CVE-2016-6788]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I058da6e62db2ce7166aad2b87a60929d6d56b4d3
kernel/events/core.c