* Oleg Nesterov <o...@redhat.com> wrote: > On 09/22, Naveen N. Rao wrote: > > > > --- a/kernel/events/uprobes.c > > +++ b/kernel/events/uprobes.c > > @@ -1751,6 +1751,19 @@ static struct uprobe *find_active_uprobe(unsigned > > long bp_vaddr, int *is_swbp) > > uprobe = find_uprobe(inode, offset); > > } > > > > + /* Ensure that the breakpoint was actually installed */ > > + if (uprobe) { > > + /* > > + * TODO: move copy_insn/etc into _register and remove > > + * this hack. After we hit the bp, _unregister + > > + * _register can install the new and not-yet-analyzed > > + * uprobe at the same address, restart. > > + */ > > + smp_rmb(); /* pairs with wmb() in prepare_uprobe() */ > > + if (unlikely(!test_bit(UPROBE_COPY_INSN, > > &uprobe->flags))) > > + uprobe = NULL; > > + } > > ACK ... > > but the comment is no longer valid, it only mentions the race unregister + > register. > > And note that "restart" is not true in that we are not going to simply > restart, > we will check is_trap_at_addr() and then either send SIGTRAP or restart. > > This is correct because we do this check under mmap_sem so we can't race with > install_breakpoint(), so is_trap_at_addr() == T can't be falsely true if > UPROBE_COPY_INSN is not set. > > And btw, perhaps you should do this check right after find_uprobe() in the > if (valid_vma) block.
Ok guys - I'll wait for the next iteration that incorporates Oleg's suggestions. Thanks, Ingo