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 v3 4/6] uretprobes: return probe entry, prepare uretprobe
Date: Sat, 2 Mar 2013 19:26:43 +0100 [thread overview]
Message-ID: <20130302182643.GA1075@redhat.com> (raw)
In-Reply-To: <1362049215-5780-5-git-send-email-anton@redhat.com>
On 02/28, Anton Arapov wrote:
>
> +static void prepare_uretprobe(struct uprobe *uprobe, struct pt_regs *regs)
> +{
> + struct return_uprobe_i *ri;
> + struct uprobe_task *utask;
> + struct xol_area *area;
> + unsigned long rp_trampoline_vaddr = 0;
> + uprobe_opcode_t insn = UPROBE_SWBP_INSN;
> +
> + area = get_xol_area();
> + if (area)
> + rp_trampoline_vaddr = area->rp_trampoline_vaddr;
> + if (!rp_trampoline_vaddr) {
> + rp_trampoline_vaddr = xol_get_insn_slot(&insn);
> + if (!rp_trampoline_vaddr)
> + return;
> + }
> + area->rp_trampoline_vaddr = rp_trampoline_vaddr;
> +
> + ri = kzalloc(sizeof(struct return_uprobe_i), GFP_KERNEL);
> + if (!ri)
> + return;
> +
> + utask = get_utask();
> + ri->orig_ret_vaddr = arch_uretprobe_hijack_return_addr(rp_trampoline_vaddr, regs);
> + if (likely(ri->orig_ret_vaddr)) {
> + /* TODO: uretprobe bypass logic */
> + atomic_inc(&uprobe->ref);
OK, but even this is not enough.
Once we inserted "int3" we must ensure that handle_swbp() will be
called even if this uprobe goes away. We have the reference but it
only protects uprobe itself, it can't protect agains delete_uprobe().
IOW, we must ensure that uprobe_pre_sstep_notifier() can't return 0.
So this patch needs the additional change in find_active_uprobe(),
- if (!uprobe && test_and_clear_bit(MMF_RECALC_UPROBES, &mm->flags))
+ if (!uprobe && hlist_empty(->return_uprobes) &&
+ test_and_clear_bit(MMF_RECALC_UPROBES, &mm->flags))
Oleg.
next prev parent reply other threads:[~2013-03-02 18:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-28 11:00 [RFC PATCH v3 0/6] uprobes: return probe implementation Anton Arapov
2013-02-28 11:00 ` [RFC PATCH v3 1/6] uretprobes: preparation patch Anton Arapov
2013-02-28 11:00 ` [RFC PATCH v3 2/6] uretprobes/x86: hijack return address Anton Arapov
2013-03-01 5:45 ` Ananth N Mavinakayanahalli
2013-03-01 11:00 ` Anton Arapov
2013-03-01 11:21 ` Ananth N Mavinakayanahalli
2013-02-28 11:00 ` [RFC PATCH v3 3/6] uretprobes: generalize xol_get_insn_slot() Anton Arapov
2013-02-28 20:01 ` Oleg Nesterov
2013-02-28 11:00 ` [RFC PATCH v3 4/6] uretprobes: return probe entry, prepare uretprobe Anton Arapov
2013-02-28 20:10 ` Oleg Nesterov
2013-03-04 14:14 ` Anton Arapov
2013-03-02 18:26 ` Oleg Nesterov [this message]
2013-03-03 16:40 ` Oleg Nesterov
2013-03-04 10:49 ` Anton Arapov
2013-02-28 11:00 ` [RFC PATCH v3 5/6] uretprobes: invoke return probe handlers Anton Arapov
2013-03-02 18:09 ` Oleg Nesterov
2013-02-28 11:00 ` [RFC PATCH v3 6/6] uretprobes: implemented, thus remove -ENOSYS 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=20130302182643.GA1075@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).