lkml.org 
[lkml]   [2013]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH v4 5/6] uretprobes: invoke return probe handlers
On 03/04, Anton Arapov wrote:
>
> +static void handle_uretprobe(struct xol_area *area, struct pt_regs *regs)
> +{
> + struct hlist_head *head;
> + struct hlist_node *tmp;
> + struct return_uprobe_i *ri;
> + struct uprobe_task *utask;
> + unsigned long orig_ret_vaddr;
> +
> + /* TODO: uretprobe bypass logic */
> +
> + utask = get_utask();
> + if (!utask) {
> + /* TODO:RFC task is not probed, do we want printk here? */
> + return;
> + }
> + head = &utask->return_uprobes;
> + hlist_for_each_entry_safe(ri, tmp, head, hlist) {
> + if (ri->uprobe->consumers) {
> + instruction_pointer_set(regs, ri->orig_ret_vaddr);

This doesn't look right if ri->orig_ret_vaddr == area->vaddr. We should
splice the list and find orig_ret_vaddr in advance.

> @@ -1589,8 +1639,11 @@ static void handle_swbp(struct pt_regs *regs)
>
> if (!uprobe) {
> if (is_swbp > 0) {
> - /* No matching uprobe; signal SIGTRAP. */
> - send_sig(SIGTRAP, current, 0);
> + area = get_xol_area();
> + if (area && bp_vaddr == area->vaddr)
> + handle_uretprobe(area, regs);
> + else
> + send_sig(SIGTRAP, current, 0);

Why? We can check bp_vaddr at the start, before find_active_uprobe().

And I'd suggest to not use area->vaddr directly, imho a trivial helper
makes sense.

Oleg.



\
 
 \ /
  Last update: 2013-03-04 18:43    [W:0.110 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site