This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [RFC] [PATCH 2.6.37-rc5-tip 8/20] 8: uprobes: mmap and fork hooks.
- From: Peter Zijlstra <peterz at infradead dot org>
- To: Srikar Dronamraju <srikar at linux dot vnet dot ibm dot com>
- Cc: Ingo Molnar <mingo at elte dot hu>, Steven Rostedt <rostedt at goodmis dot org>, Linux-mm <linux-mm at vger dot kernel dot org>, Arnaldo Carvalho de Melo <acme at infradead dot org>, Linus Torvalds <torvalds at linux-foundation dot org>, Ananth N Mavinakayanahalli <ananth at in dot ibm dot com>, Christoph Hellwig <hch at infradead dot org>, Masami Hiramatsu <masami dot hiramatsu dot pt at hitachi dot com>, Oleg Nesterov <oleg at redhat dot com>, LKML <linux-kernel at vger dot kernel dot org>, SystemTap <systemtap at sources dot redhat dot com>, Jim Keniston <jkenisto at linux dot vnet dot ibm dot com>, Frederic Weisbecker <fweisbec at gmail dot com>, Andi Kleen <andi at firstfloor dot org>, Andrew Morton <akpm at linux-foundation dot org>, "Paul E. McKenney" <paulmck at linux dot vnet dot ibm dot com>
- Date: Tue, 25 Jan 2011 13:15:39 +0100
- Subject: Re: [RFC] [PATCH 2.6.37-rc5-tip 8/20] 8: uprobes: mmap and fork hooks.
- References: <20101216095714.23751.52601.sendpatchset@localhost6.localdomain6> <20101216095848.23751.73144.sendpatchset@localhost6.localdomain6>
On Thu, 2010-12-16 at 15:28 +0530, Srikar Dronamraju wrote:
> +void uprobe_mmap(struct vm_area_struct *vma)
> +{
> + struct list_head tmp_list;
> + struct uprobe *uprobe, *u;
> + struct mm_struct *mm;
> + struct inode *inode;
> +
> + if (!valid_vma(vma))
> + return;
> +
> + INIT_LIST_HEAD(&tmp_list);
> +
> + /*
> + * The vma was just allocated and this routine gets called
> + * while holding write lock for mmap_sem. Function called
> + * in context of a thread that has a reference to mm.
> + * Hence no need to take a reference to mm
> + */
> + mm = vma->vm_mm;
> + up_write(&mm->mmap_sem);
Are you very very sure its a good thing to simply drop the mmap_sem
here? Also, why?
> + mutex_lock(&uprobes_mutex);
> +
> + inode = vma->vm_file->f_mapping->host;
Since you just dropped the mmap_sem, what's keeping that vma from going
away?
> + add_to_temp_list(vma, inode, &tmp_list);
> +
> + list_for_each_entry_safe(uprobe, u, &tmp_list, pending_list) {
> + mm->uprobes_vaddr = vma->vm_start + uprobe->offset;
> + install_uprobe(mm, uprobe);
> + list_del(&uprobe->pending_list);
> + }
> + mutex_unlock(&uprobes_mutex);
> + down_write(&mm->mmap_sem);
> +}