All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Anton Arapov <anton@redhat.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Josh Stone <jistone@redhat.com>, Frank Eigler <fche@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>,
	Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Subject: Re: [RFC PATCH v4 4/6] uretprobes: return probe entry, prepare uretprobe
Date: Mon, 4 Mar 2013 17:47:53 +0100	[thread overview]
Message-ID: <20130304164753.GA3328@redhat.com> (raw)
In-Reply-To: <1362407893-32505-5-git-send-email-anton@redhat.com>

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.


  reply	other threads:[~2013-03-04 16:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-04 14:38 [RFC PATCH v4 0/6] uprobes: return probe implementation Anton Arapov
2013-03-04 14:38 ` [RFC PATCH v4 1/6] uretprobes: preparation patch Anton Arapov
2013-03-04 14:38 ` [RFC PATCH v4 2/6] uretprobes/x86: hijack return address Anton Arapov
2013-03-04 14:38 ` [RFC PATCH v4 3/6] uretprobes: generalize xol_get_insn_slot() Anton Arapov
2013-03-04 14:38 ` [RFC PATCH v4 4/6] uretprobes: return probe entry, prepare uretprobe Anton Arapov
2013-03-04 16:47   ` Oleg Nesterov [this message]
2013-03-05 13:20     ` Anton Arapov
2013-03-04 14:38 ` [RFC PATCH v4 5/6] uretprobes: invoke return probe handlers Anton Arapov
2013-03-04 16:51   ` Oleg Nesterov
2013-03-05 13:28     ` Anton Arapov
2013-03-05  7:03   ` Ananth N Mavinakayanahalli
2013-03-05 13:18     ` Anton Arapov
2013-03-04 14:38 ` [RFC PATCH v4 6/6] uretprobes: implemented, thus remove -ENOSYS Anton Arapov
2013-03-05 12:04 ` [RFC PATCH v4 0/6] uprobes: return probe implementation Ingo Molnar
2013-03-05 12:22   ` Anton Arapov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130304164753.GA3328@redhat.com \
    --to=oleg@redhat.com \
    --cc=ananth@in.ibm.com \
    --cc=anton@redhat.com \
    --cc=fche@redhat.com \
    --cc=jistone@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=srikar@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.