lkml.org 
[lkml]   [2013]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH v2 3/4] uretprobes: return probe entry, prepare uretprobe
On Wed, Jan 09, 2013 at 05:17:01PM +0100, Oleg Nesterov wrote:
> On 01/09, Anton Arapov wrote:
> >
> > todo:
> > protect uprobe
>
> Yep ;)
>
> > static struct uprobe_task *get_utask(void)
> > {
> > - if (!current->utask)
> > + if (!current->utask) {
> > current->utask = kzalloc(sizeof(struct uprobe_task), GFP_KERNEL);
> > + INIT_HLIST_HEAD(&current->utask->return_uprobes);
>
> What if kzalloc() fails?
:)

>
> > +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;
> > +
> > + area = get_xol_area();
> > + if (area)
> > + rp_trampoline_vaddr = area->rp_trampoline_vaddr;
> > + if (!rp_trampoline_vaddr) {
> > + rp_trampoline_vaddr = xol_get_trampoline_slot();
>
> This is obviously racy. But again, so far I think we can simply remove
> this.
working on this...

> > 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 */
>
> This doesn't look right. prepare_uretprobe() should not be called
> multiple times.
Overlooked this issue, thanks for catching.

Anton.
>
> Oleg.
>


\
 
 \ /
  Last update: 2013-01-10 13:21    [W:0.051 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site