From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755967AbZBFBNd (ORCPT ); Thu, 5 Feb 2009 20:13:33 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752121AbZBFBNY (ORCPT ); Thu, 5 Feb 2009 20:13:24 -0500 Received: from tomts22-srv.bellnexxia.net ([209.226.175.184]:36563 "EHLO tomts22-srv.bellnexxia.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752719AbZBFBNX (ORCPT ); Thu, 5 Feb 2009 20:13:23 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsIEAKsZi0lMQWt2/2dsb2JhbACBbs13hBYG Date: Thu, 5 Feb 2009 20:13:20 -0500 From: Mathieu Desnoyers To: Ingo Molnar Cc: Masami Hiramatsu , Andrew Morton , Linus Torvalds , Greg KH , Nick Piggin , LKML , Ananth N Mavinakayanahalli , Jim Keniston , systemtap-ml , "Frank Ch. Eigler" Subject: Re: [BUGFIX][PATCH -rc/-mm] prevent kprobes from catching spurious page faults Message-ID: <20090206011320.GA7161@Krystal> References: <497FC3B1.7050805@redhat.com> <497FE895.1080708@redhat.com> <20090128154824.GA6025@Krystal> <49808EEF.1020700@redhat.com> <20090128171331.GA9006@Krystal> <49809CCE.40409@redhat.com> <20090128181053.GC9908@Krystal> <498B6457.20302@redhat.com> <20090205235727.GA16040@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline In-Reply-To: <20090205235727.GA16040@elte.hu> X-Editor: vi X-Info: http://krystal.dyndns.org:8080 X-Operating-System: Linux/2.6.21.3-grsec (i686) X-Uptime: 20:10:21 up 36 days, 1:08, 9 users, load average: 0.31, 0.23, 0.27 User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Ingo Molnar (mingo@elte.hu) wrote: > > * Masami Hiramatsu wrote: > > > - if (notify_page_fault(regs)) > > - return; > > if (unlikely(kmmio_fault(regs, address))) > > return; > > > > @@ -634,6 +632,9 @@ void __kprobes do_page_fault(struct pt_r > > if (spurious_fault(address, error_code)) > > return; > > > > + /* kprobes don't want to hook the spurious faults. */ > > + if (notify_page_fault(regs)) > > + return; > > /* > > * Don't take the mm semaphore here. If we fixup a prefetch > > * fault we could otherwise deadlock. > > @@ -641,6 +642,9 @@ void __kprobes do_page_fault(struct pt_r > > goto bad_area_nosemaphore; > > } > > > > + /* kprobes don't want to hook the spurious faults. */ > > + if (notify_page_fault(regs)) > > + return; > > I dont know - this spreads that callback to two places now. Any > reason why kprobes cannot call spurious_fault(), if there's a > probe active? > > Also, moving that would remove the planned cleanup of merging these > two into one call: > > if (notify_page_fault(regs)) > return; > if (unlikely(kmmio_fault(regs, address))) > return; > > We should reduce the probing cross section, not increase it, > especially in such a critical codepath as the pagefault handler. > > Btw., why cannot kprobes install a dynamic probe to the fault > handler itself? That way the default path would have no such > callbacks and checks at all. > Or we could simply merge my 2 LTTng page fault handler tracepoints per architecture and be done with it ? I'd need to clean up the patchset a little bit to fold a few patches, but that would be straightforward enough. Mathieu -- Mathieu Desnoyers OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68