On 03/04, Anton Arapov wrote:
>
> @@ -1085,6 +1093,7 @@ static int xol_add_vma(struct xol_area *area)
>  {
>       struct mm_struct *mm = current->mm;
>       int ret = -EALREADY;
> +     uprobe_opcode_t insn = UPROBE_SWBP_INSN;
>
>       down_write(&mm->mmap_sem);
>       if (mm->uprobes_state.xol_area)
> @@ -1106,6 +1115,13 @@ static int xol_add_vma(struct xol_area *area)
>       smp_wmb();      /* pairs with get_xol_area() */
>       mm->uprobes_state.xol_area = area;
>       ret = 0;
> +
> +     /*
> +      * If we reached this place, we did allocate a new area. We want
> +      * pre-alloc a slot for the return probes here.
> +      */
> +     xol_get_insn_slot(&insn);

Just change get_xol_area() to do set_bit(0, bitmap) and copy_to_page(page, int3)
(extacted from xol_get_insn_slot().

> @@ -1485,8 +1538,11 @@ static struct uprobe *find_active_uprobe(unsigned long 
> bp_vaddr, int *is_swbp)
>               *is_swbp = -EFAULT;
>       }
>  
> -     if (!uprobe && test_and_clear_bit(MMF_RECALC_UPROBES, &mm->flags))
> +     utask = get_utask();
> +     if (!uprobe && hlist_empty(&utask->return_uprobes) &&
> +         test_and_clear_bit(MMF_RECALC_UPROBES, &mm->flags)) {
>               mmf_recalc_uprobes(mm);

Wait, I was wrong. We should not clear MMF_* if another thread has
->return_uprobes. Perhaps we should change uprobe_pre_sstep_notifier()
instead...

>       down_read(&uprobe->register_rwsem);
>       for (uc = uprobe->consumers; uc; uc = uc->next) {
> -             int rc = uc->handler(uc, regs);
> +             if (uc->handler)
> +                     rc = uc->handler(uc, regs);
> +
> +             if (uc->rp_handler)
> +                     prepare_uretprobe(uprobe, regs); /* put bp at return */

Again, this is not right. We should do this only once after the main
loop.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to