From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2906 invoked by alias); 6 Feb 2009 15:56:44 -0000 Received: (qmail 2897 invoked by uid 22791); 6 Feb 2009 15:56:43 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 Feb 2009 15:56:37 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n16FuZSX031278 for ; Fri, 6 Feb 2009 10:56:35 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n16Fua3r030814 for ; Fri, 6 Feb 2009 10:56:36 -0500 Received: from [10.16.2.107] (dhcp-100-2-107.bos.redhat.com [10.16.2.107]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n16FuXIe030414; Fri, 6 Feb 2009 10:56:34 -0500 Message-ID: <498C5DDB.70808@redhat.com> Date: Fri, 06 Feb 2009 16:30:00 -0000 From: Masami Hiramatsu User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: Ingo Molnar CC: Andrew Morton , Linus Torvalds , Greg KH , Mathieu Desnoyers , 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 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> In-Reply-To: <20090205235727.GA16040@elte.hu> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2009-q1/txt/msg00392.txt.bz2 Ingo Molnar 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? Hmm, because I think how the spurious faults are treated depends on do_page_fault(). Calling spurious_fault() and vmalloc_fault() in kprobe_fault_handler() is just spreading another code different way... > 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; Sure, that is reasonable, if kmmio also want not catch spurious fault too. > We should reduce the probing cross section, not increase it, > especially in such a critical codepath as the pagefault handler. I think my patch doesn't increase it, the first path jumps to bad_area_nosemaphore right after calling notify_page_fault(). > > 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. because kprobe_fault_handler() is implemented not only for the user fault handler but also for fixup page-fault ip during single step out-of-line. It's an elemental part of kprobes. Thank you, -- Masami Hiramatsu Software Engineer Hitachi Computer Products (America) Inc. Software Solutions Division e-mail: mhiramat@redhat.com