uprobes: Introduce find_active_uprobe() helper
authorOleg Nesterov <oleg@redhat.com>
Tue, 29 May 2012 19:28:57 +0000 (21:28 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 6 Jun 2012 15:15:17 +0000 (17:15 +0200)
commit3a9ea0520f38def4a3915b91f82455b749f07d88
tree810a4d5bb6f075497ad3b2cd94c120ae235e026f
parenta3d7bb47937b3a40b9f0c75655e97b3bb6407cbe
uprobes: Introduce find_active_uprobe() helper

No functional changes. Move the "find uprobe" code from
handle_swbp() to the new helper, find_active_uprobe().

Note: with or without this change, the find-active-uprobe logic
is not exactly right. We can race with another thread which
unmaps the memory with the valid uprobe before we take
mm->mmap_sem. We can't find this uprobe simply because
find_vma() fails. In this case we wrongly assume that this trap
was not caused by uprobe and send the erroneous SIGTRAP. See the
next changes.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Anton Arapov <anton@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20120529192857.GC8057@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/events/uprobes.c