uretprobes: preparation patch

  Enclose return uprobes implementation and prepare the existing
functions that relies on set ->handler().

v5 changes:
  - don't remove uprobe in case there are no uprobe consumer(handler),
    see handler_chain() changes.
v3 changes: (the patch is introduced in v3)
  - check whether at least one of the consumer's handlers were set
  - a 'TODO' cap that will be removed once return probes be implemented

Signed-off-by: Anton Arapov <anton@redhat.com>
uretprobes/x86: hijack return address

  hijack the return address and replace it with a "trampoline"

v5:
  - change the fail return code, because orig_ret_vaddr=0 is possible
  - style fixup
v2:
  - remove ->doomed flag, kill task immediately

Signed-off-by: Anton Arapov <anton@redhat.com>
uretprobes: add fill_page() helper and allocate page

  %description%

Signed-off-by: Anton Arapov <anton@redhat.com>
uretprobes: return probe entry, prepare uretprobe

  When a uprobe with return consumer is hit, prepare_uretprobe function is
invoked. It creates return_uprobe, hijacks return address and replaces
it with the trampoline.

 N.B. it might be a good idea to introduce get_uprobe() to reflect
put_uprobe() later, but it is not a subject of this patchset.

v6:
 - kill the list from v5 now...

v5:
 - switch from hlist to simply linked list for tracking ->*return_uprobes.
 - revert (*) from v4
 - rework handler_chain() logic
 - add fill_page() helper
 - preallocate first slot xol_area for return probes, see xol_get_area()
   changes
 - add uretprobe_trampoline_vaddr() helper, to emphasize area->vaddr
   overload
v4:
 - get rid of area->rp_trampoline_vaddr as it always the same as ->vaddr
 - cleanup ->return_uprobes list in uprobe_free_utask(), because the
   task can exit from inside the ret-probe'd function(s).
*- in find_active_uprobe(): Once we inserted "int3" we must ensure that
   handle_swbp() will be called even if this uprobe goes away. We have
   the reference but it only protects uprobe itself, it can't protect
   agains delete_uprobe().
   IOW, we must ensure that uprobe_pre_sstep_notifier() can't return 0.
v3:
 - protected uprobe with refcounter. See atomic_inc in prepare_uretprobe()
and put_uprobe() in a following patch in handle_uretprobe()
v2:
 - get rid of ->return_consumers member from struct uprobe, introduce
rp_handler() in consumer

Signed-off-by: Anton Arapov <anton@redhat.com>
uretprobes: invoke return probe handlers

  Uretprobe handlers are invoked when the trampoline is hit, on completion the
trampoline is replaced with the saved return address and the uretprobe instance
deleted.

v5:
 - switch to simply linked list ->return_uprobes
 - rework handle_uretprobe()
v4:
 - check, whether utask is not NULL in handle_uretprobe()
   ? do we want a printk() for this case?
 - get rid of area->rp_trampoline_vaddr
 - minor handle_uretprobe() fixups
v3:
 - protected uprobe with refcounter. See put_uprobe() in handle_uretprobe()
that reflects increment in prepare_uretprobe()
v2:
 - get rid of ->return_consumers member from struct uprobe, introduce
rp_handler() in consumer instead

Signed-off-by: Anton Arapov <anton@redhat.com>
uretprobes: implemented, thus remove -ENOSYS

  enclose return probes implementation

v3 changes: (the patch is introduced in v3)
  - remove 'TODO' as return probes implemented now

Signed-off-by: Anton Arapov <anton@redhat.com>
dump

Signed-off-by: Anton Arapov <anton@redhat.com>