From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752812Ab1AZKUL (ORCPT ); Wed, 26 Jan 2011 05:20:11 -0500 Received: from casper.infradead.org ([85.118.1.10]:47118 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752170Ab1AZKUK convert rfc822-to-8bit (ORCPT ); Wed, 26 Jan 2011 05:20:10 -0500 Subject: Re: [RFC] [PATCH 2.6.37-rc5-tip 8/20] 8: uprobes: mmap and fork hooks. From: Peter Zijlstra To: Srikar Dronamraju Cc: Ingo Molnar , Steven Rostedt , Linux-mm , Arnaldo Carvalho de Melo , Linus Torvalds , Ananth N Mavinakayanahalli , Christoph Hellwig , Masami Hiramatsu , Oleg Nesterov , LKML , SystemTap , Jim Keniston , Frederic Weisbecker , Andi Kleen , Andrew Morton , "Paul E. McKenney" In-Reply-To: <20110126090346.GH19725@linux.vnet.ibm.com> References: <20101216095714.23751.52601.sendpatchset@localhost6.localdomain6> <20101216095848.23751.73144.sendpatchset@localhost6.localdomain6> <1295957739.28776.717.camel@laptop> <20110126090346.GH19725@linux.vnet.ibm.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Date: Wed, 26 Jan 2011 11:20:39 +0100 Message-ID: <1296037239.28776.1149.camel@laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2011-01-26 at 14:33 +0530, Srikar Dronamraju wrote: > > > I actually dont like to release the write_lock and then reacquire it. > write_opcode, which is called thro install_uprobe, i.e to insert the > actual breakpoint instruction takes a read lock on the mmap_sem. > Hence uprobe_mmap gets called in context with write lock on mmap_sem > held, I had to release it before calling install_uprobe. Ah, right, so that's going to give you a head-ache ;-) The moment you release this mmap_sem, the map you're going to install the probe point in can go away. The only way to make this work seems to start by holding the mmap_sem for writing and make a breakpoint install function that assumes its taken and doesn't try to acquire it again.