[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130304141419.GB26880@bandura.brq.redhat.com>
Date: Mon, 4 Mar 2013 15:14:19 +0100
From: Anton Arapov <anton@...hat.com>
To: Oleg Nesterov <oleg@...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 v3 4/6] uretprobes: return probe entry, prepare
uretprobe
On Thu, Feb 28, 2013 at 09:10:24PM +0100, Oleg Nesterov wrote:
> 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;
>
> This is called under down_read(), so 2 threads can race with each other
> and use the different rp_trampoline_vaddr's if ->rp_trampoline_vaddr was
> NULL.
> And again, I think ->rp_trampoline_vaddr is simply unneeded, see my
> reply to 3/6.
Yes, 'fixed' this, I will send quirky v4 in a few, to maintain your attention. :)
>
> > static void handler_chain(struct uprobe *uprobe, struct pt_regs *regs)
> > {
> > + int rc = 0;
> > struct uprobe_consumer *uc;
> > int remove = UPROBE_HANDLER_REMOVE;
> >
> > 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 */
>
> Hmm. I didn't read this series yet. But at first glance I am not
> sure prepare_uretprobe() should be called every time we see
> ->rp_handler != NULL, there could be multiple consumers...
I can not come up with a better idea yet, that would narrow down the
number of prepare_uretprobe() calls.
Anton.
--
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