kernel-ark/kernel/events
Oleg Nesterov 8b4d801b2b hw_breakpoint: Fix cpu check in task_bp_pinned(cpu)
trinity fuzzer triggered WARN_ONCE("Can't find any breakpoint
slot") in arch_install_hw_breakpoint() but the problem is not
arch-specific.

The problem is, task_bp_pinned(cpu) checks "cpu == iter->cpu"
but this doesn't account the "all cpus" events with iter->cpu <
0.

This means that, say, register_user_hw_breakpoint(tsk) can
happily create the arbitrary number > HBP_NUM of breakpoints
which can not be activated. toggle_bp_task_slot() is equally
wrong by the same reason and nr_task_bp_pinned[] can have
negative entries.

Simple test:

	# perl -e 'sleep 1 while 1' &
	# perf record -e mem:0x10,mem:0x10,mem:0x10,mem:0x10,mem:0x10 -p `pidof perl`

Before this patch this triggers the same problem/WARN_ON(),
after the patch it correctly fails with -ENOSPC.

Reported-by: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: <stable@vger.kernel.org>
Link: http://lkml.kernel.org/r/20130620155006.GA6324@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2013-06-20 17:57:00 +02:00
..
callchain.c perf: Add attribute to filter out callchains 2012-08-10 12:40:57 -03:00
core.c perf: Fix mmap() accounting hole 2013-06-19 12:44:13 +02:00
hw_breakpoint.c hw_breakpoint: Fix cpu check in task_bp_pinned(cpu) 2013-06-20 17:57:00 +02:00
internal.h perf: Fix mmap() accounting hole 2013-06-19 12:44:13 +02:00
Makefile uprobes: Move to kernel/events/ 2012-02-22 11:08:00 +01:00
ring_buffer.c perf: Fix vmalloc ring buffer pages handling 2013-05-01 12:34:46 +02:00
uprobes.c uretprobes: Remove -ENOSYS as return probes implemented 2013-04-13 15:31:58 +02:00