linux-stable/arch
Peter Zijlstra d5b5f391d4 ftrace, perf: Avoid infinite event generation loop
Vince's perf-trinity fuzzer found yet another 'interesting' problem.

When we sample the irq_work_exit tracepoint with period==1 (or
PERF_SAMPLE_PERIOD) and we add an fasync SIGNAL handler we create an
infinite event generation loop:

  ,-> <IPI>
  |     irq_work_exit() ->
  |       trace_irq_work_exit() ->
  |         ...
  |           __perf_event_overflow() -> (due to fasync)
  |             irq_work_queue() -> (irq_work_list must be empty)
  '---------      arch_irq_work_raise()

Similar things can happen due to regular poll() wakeups if we exceed
the ring-buffer wakeup watermark, or have an event_limit.

To avoid this, dis-allow sampling this particular tracepoint.

In order to achieve this, create a special perf_perm function pointer
for each event and call this (when set) on trying to create a
tracepoint perf event.

[ roasted: use expr... to allow for ',' in your expression ]

Reported-by: Vince Weaver <vincent.weaver@maine.edu>
Tested-by: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Dave Jones <davej@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/20131114152304.GC5364@laptop.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2013-11-19 16:57:40 +01:00
..
alpha Kconfig cleanups for v3.13 2013-11-15 14:05:15 -08:00
arc Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-11-15 16:47:22 -08:00
arm Merge git://www.linux-watchdog.org/linux-watchdog 2013-11-18 15:56:13 -08:00
arm64 Here are the 3.13 KVM changes. There was a lot of work on the PPC 2013-11-15 13:51:36 +09:00
avr32 avr32: handle pgtable_page_ctor() fail 2013-11-15 09:32:17 +09:00
blackfin blackfin updates for Linux 3.13 2013-11-15 14:27:22 -08:00
c6x Kconfig cleanups for v3.13 2013-11-15 14:05:15 -08:00
cris cris: handle pgtable_page_ctor() fail 2013-11-15 09:32:17 +09:00
frv frv: handle pgtable_page_ctor() fail 2013-11-15 09:32:17 +09:00
hexagon kernel: remove CONFIG_USE_GENERIC_SMP_HELPERS 2013-11-15 09:32:22 +09:00
ia64 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-11-15 16:47:22 -08:00
m32r Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-11-15 16:47:22 -08:00
m68k Kconfig cleanups for v3.13 2013-11-15 14:05:15 -08:00
metag kernel: remove CONFIG_USE_GENERIC_SMP_HELPERS 2013-11-15 09:32:22 +09:00
microblaze Kconfig cleanups for v3.13 2013-11-15 14:05:15 -08:00
mips MMC highlights for 3.13: 2013-11-18 14:47:30 -08:00
mn10300 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-11-15 16:47:22 -08:00
openrisc OpenRISC updates for 3.13 2013-11-15 14:26:38 -08:00
parisc Kconfig cleanups for v3.13 2013-11-15 14:05:15 -08:00
powerpc Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-11-15 16:47:22 -08:00
s390 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-11-15 16:47:22 -08:00
score score: handle pgtable_page_ctor() fail 2013-11-15 09:32:18 +09:00
sh MMC highlights for 3.13: 2013-11-18 14:47:30 -08:00
sparc Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-11-15 16:47:22 -08:00
tile kernel: remove CONFIG_USE_GENERIC_SMP_HELPERS 2013-11-15 09:32:22 +09:00
um um: handle pgtable_page_ctor() fail 2013-11-15 09:32:19 +09:00
unicore32 pwm: Changes for v3.13-rc1 2013-11-16 12:21:40 -08:00
x86 ftrace, perf: Avoid infinite event generation loop 2013-11-19 16:57:40 +01:00
xtensa xtensa: use buddy allocator for PTE table 2013-11-15 09:32:19 +09:00
.gitignore
Kconfig kernel: remove CONFIG_USE_GENERIC_SMP_HELPERS 2013-11-15 09:32:22 +09:00