Skip to content

RFC uprobes: return probe implementation

Anton Arapov lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 RFC Latest6 patches 8 repliesIn review
  2. v3 RFC6 patches 10 repliesSuperseded
  3. v2 RFC4 patches 6 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v1 RFC6 patches14 repliesSuperseded

Changes in v4 from the cover letter

- get rid of area->rp_trampoline_vaddr as it always the same as ->vaddr
- preallocate slot, as the first one in xol_add_vma()
- 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.
- check, whether utask is not NULL in handle_uretprobe()
? do we want a printk() for this case?
- minor handle_uretprobe() fixups

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6uretprobes: preparation patchinclude/linux/uprobes.h kernel/events/uprobes.c+9 -00 replies
2/6uretprobes/x86: hijack return addressarch/x86/include/asm/uprobes.h arch/x86/kernel/uprobes.c+30 -00 replies
3/6uretprobes: generalize xol_get_insn_slot()kernel/events/uprobes.c+3 -30 replies
4/6uretprobes: return probe entry, prepare uretprobeinclude/linux/uprobes.h kernel/events/uprobes.c+68 -32 replies
5/6uretprobes: invoke return probe handlersarch/x86/include/asm/uprobes.h kernel/events/uprobes.c+60 -24 replies
6/6uretprobes: implemented, thus remove -ENOSYSkernel/events/uprobes.c+0 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [RFC PATCH v4 0/6] uprobes: return probe implementation

Hello,

RFC v4 uretprobes implementation. I'd be grateful for review. /* Oleg, this one is more quirky than previous, don't beat me. */

These patches extending uprobes by enabling tools, such as perf(trace_event),
set a breakpoint on probed function's return address.

v4:
- get rid of area->rp_trampoline_vaddr as it always the same as ->vaddr
- preallocate slot, as the first one in xol_add_vma()
- 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.
- check, whether utask is not NULL in handle_uretprobe()
? do we want a printk() for this case?
- minor handle_uretprobe() fixups

v3 changes:
- removed uretprobe_bypass logic, it will be better to send it as independent patch
- unified xol_get_trampoline_slot() and xol_get_insn_slot()
- protected uprobe with refcounter in prepare_uretprobe()
- uprobe_register() routine fails now, if neither consumer is set
- enclosed implementation into 1/6, 6/6 patches -ENOSYS bits

v2 changes:
- introduced rp_handler(), get rid of return_consumers
- get rid of uretprobe_[un]register()
- introduced arch_uretprobe_get_sp()
- removed uprobe_task->doomed, kill task immediately
- fix arch_uretprobe_hijack_return_addr()'s returns
- address the v1 minor issues

integrated patchset:
http://github.com/arapov/linux-aa/commits/uretprobes_v3

previous implementations:
RFCv3: https://lkml.org/lkml/2013/2/28/148
RFCv2: https://lkml.org/lkml/2013/1/9/157
RFCv1: https://lkml.org/lkml/2012/12/21/133

thanks,
Anton

Anton Arapov (6):
uretprobes: preparation patch uretprobes/x86: hijack return address
uretprobes: generalize xol_get_insn_slot()
uretprobes: return probe entry, prepare uretprobe
uretprobes: invoke return probe handlers
uretprobes: implemented, thus remove -ENOSYS

 arch/x86/include/asm/uprobes.h |   6 ++
 arch/x86/kernel/uprobes.c      |  29 +++++++++
 include/linux/uprobes.h        |   5 ++
 kernel/events/uprobes.c        | 134 ++++++++++++++++++++++++++++++++++++++---
 4 files changed, 166 insertions(+), 8 deletions(-)
Signature · 1 line
1.8.1.2