From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32692 invoked by alias); 30 Aug 2009 02:41:54 -0000 Received: (qmail 32673 invoked by uid 22791); 30 Aug 2009 02:41:53 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1-old.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 30 Aug 2009 02:41:47 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com ([10.11.47.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n7U2fhQt022172 for ; Sat, 29 Aug 2009 22:41:44 -0400 Received: from [10.11.8.192] (vpn-8-192.rdu.redhat.com [10.11.8.192]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7U2fcHE013163; Sat, 29 Aug 2009 22:41:39 -0400 Message-ID: <4A99E755.8000700@redhat.com> Date: Sun, 30 Aug 2009 02:41:00 -0000 From: Masami Hiramatsu User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Thunderbird/3.0b3 MIME-Version: 1.0 To: Frederic Weisbecker CC: Ingo Molnar , lkml , systemtap , DLE , Ananth N Mavinakayanahalli Subject: Re: [PATCH -tip tracing/kprobes 3/6] kprobes/x86: Fix to add __kprobes to in-kernel fault handing functions References: <20090827152539.GE6058@nowhere> <20090827172311.8246.92725.stgit@localhost.localdomain> <20090830005008.GA387@nowhere> In-Reply-To: <20090830005008.GA387@nowhere> 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-q3/txt/msg00500.txt.bz2 Frederic Weisbecker wrote: > On Thu, Aug 27, 2009 at 01:23:11PM -0400, Masami Hiramatsu wrote: >> Add __kprobes to the functions which handles in-kernel fixable page faults. >> Since kprobes can cause those in-kernel page faults by accessing kprobe data >> structures, probing those fault functions will cause fault-int3-loop >> (do_page_fault has already been marked as __kprobes). >> >> Signed-off-by: Masami Hiramatsu >> Cc: Frederic Weisbecker >> Cc: Ananth N Mavinakayanahalli >> Cc: Ingo Molnar >> --- >> >> arch/x86/mm/fault.c | 11 ++++++----- >> 1 files changed, 6 insertions(+), 5 deletions(-) >> >> diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c >> index bfae139..c322e59 100644 >> --- a/arch/x86/mm/fault.c >> +++ b/arch/x86/mm/fault.c >> @@ -38,7 +38,8 @@ enum x86_pf_error_code { >> * Returns 0 if mmiotrace is disabled, or if the fault is not >> * handled by mmiotrace: >> */ >> -static inline int kmmio_fault(struct pt_regs *regs, unsigned long addr) >> +static inline int __kprobes >> +kmmio_fault(struct pt_regs *regs, unsigned long addr) >> { >> if (unlikely(is_kmmio_active())) >> if (kmmio_handler(regs, addr) == 1) > > > I guess the problem also resides in a lot of subfunctions such as kmmio_handler > and such... Hmm, sure. kmmio functions should be marked as __kprobes( or __kmmio or __debug? :)). Thank you, >> @@ -46,7 +47,7 @@ static inline int kmmio_fault(struct pt_regs *regs, unsigned long addr) >> return 0; >> } >> >> -static inline int notify_page_fault(struct pt_regs *regs) >> +static inline int __kprobes notify_page_fault(struct pt_regs *regs) >> { >> int ret = 0; >> >> @@ -239,7 +240,7 @@ void vmalloc_sync_all(void) >> * >> * Handle a fault on the vmalloc or module mapping area >> */ >> -static noinline int vmalloc_fault(unsigned long address) >> +static noinline __kprobes int vmalloc_fault(unsigned long address) >> { >> unsigned long pgd_paddr; >> pmd_t *pmd_k; >> @@ -361,7 +362,7 @@ void vmalloc_sync_all(void) >> * >> * This assumes no large pages in there. >> */ >> -static noinline int vmalloc_fault(unsigned long address) >> +static noinline __kprobes int vmalloc_fault(unsigned long address) >> { >> pgd_t *pgd, *pgd_ref; >> pud_t *pud, *pud_ref; >> @@ -858,7 +859,7 @@ static int spurious_fault_check(unsigned long error_code, pte_t *pte) >> * There are no security implications to leaving a stale TLB when >> * increasing the permissions on a page. >> */ >> -static noinline int >> +static noinline __kprobes int >> spurious_fault(unsigned long error_code, unsigned long address) >> { >> pgd_t *pgd; >> >> >> -- >> Masami Hiramatsu >> >> Software Engineer >> Hitachi Computer Products (America), Inc. >> Software Solutions Division >> >> e-mail: mhiramat@redhat.com > -- Masami Hiramatsu Software Engineer Hitachi Computer Products (America), Inc. Software Solutions Division e-mail: mhiramat@redhat.com