[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130304164753.GA3328@redhat.com>
Date: Mon, 4 Mar 2013 17:47:53 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Anton Arapov <anton@...hat.com>
Cc: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
LKML <linux-kernel@...r.kernel.org>,
Josh Stone <jistone@...hat.com>,
Frank Eigler <fche@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...e.hu>,
Ananth N Mavinakayanahalli <ananth@...ibm.com>
Subject: Re: [RFC PATCH v4 4/6] uretprobes: return probe entry, prepare
uretprobe
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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists