Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756197Ab3CENVL (ORCPT ); Tue, 5 Mar 2013 08:21:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58696 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752633Ab3CENVK (ORCPT ); Tue, 5 Mar 2013 08:21:10 -0500 Date: Tue, 5 Mar 2013 14:20:55 +0100 From: Anton Arapov To: Oleg Nesterov Cc: Srikar Dronamraju , LKML , Josh Stone , Frank Eigler , Peter Zijlstra , Ingo Molnar , Ananth N Mavinakayanahalli Subject: Re: [RFC PATCH v4 4/6] uretprobes: return probe entry, prepare uretprobe Message-ID: <20130305132055.GB24229@bandura.brq.redhat.com> References: <1362407893-32505-1-git-send-email-anton@redhat.com> <1362407893-32505-5-git-send-email-anton@redhat.com> <20130304164753.GA3328@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130304164753.GA3328@redhat.com> X-PGP-Key: http://people.redhat.com/aarapov/gpg User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2116 Lines: 59 On Mon, Mar 04, 2013 at 05:47:53PM +0100, Oleg Nesterov wrote: > On 03/04, Anton Arapov wrote: > > > > @@ -1085,6 +1093,7 @@ static int xol_add_vma(struct xol_area *area) > > { > > struct mm_struct *mm = current->mm; > > int ret = -EALREADY; > > + uprobe_opcode_t insn = UPROBE_SWBP_INSN; > > > > down_write(&mm->mmap_sem); > > if (mm->uprobes_state.xol_area) > > @@ -1106,6 +1115,13 @@ static int xol_add_vma(struct xol_area *area) > > smp_wmb(); /* pairs with get_xol_area() */ > > mm->uprobes_state.xol_area = area; > > ret = 0; > > + > > + /* > > + * If we reached this place, we did allocate a new area. We want > > + * pre-alloc a slot for the return probes here. > > + */ > > + xol_get_insn_slot(&insn); > Just change get_xol_area() to do set_bit(0, bitmap) and copy_to_page(page, int3) > (extacted from xol_get_insn_slot(). ah yes, right. Thanks for this hint. > > > @@ -1485,8 +1538,11 @@ static struct uprobe *find_active_uprobe(unsigned long bp_vaddr, int *is_swbp) > > *is_swbp = -EFAULT; > > } > > > > - if (!uprobe && test_and_clear_bit(MMF_RECALC_UPROBES, &mm->flags)) > > + utask = get_utask(); > > + if (!uprobe && hlist_empty(&utask->return_uprobes) && > > + test_and_clear_bit(MMF_RECALC_UPROBES, &mm->flags)) { > > mmf_recalc_uprobes(mm); > Wait, I was wrong. We should not clear MMF_* if another thread has > ->return_uprobes. Perhaps we should change uprobe_pre_sstep_notifier() > instead... Will look into it. > > 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 */ > Again, this is not right. We should do this only once after the main > loop. fixed for v5. Thanks! Anton. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/