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 5/6] uretprobes: invoke return probe handlers
Date: Mon, 4 Mar 2013 17:51:20 +0100	[thread overview]
Message-ID: <20130304165120.GB3328@redhat.com> (raw)
In-Reply-To: <1362407893-32505-6-git-send-email-anton@redhat.com>

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.


  reply	other threads:[~2013-03-04 16:53 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
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 [this message]
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=20130304165120.GB3328@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.