From patchwork Mon Oct 5 23:49:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Tjernlund X-Patchwork-Id: 35058 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 3606BB7E35 for ; Tue, 6 Oct 2009 10:53:54 +1100 (EST) Received: by ozlabs.org (Postfix) id 1655BB7BAA; Tue, 6 Oct 2009 10:53:48 +1100 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from gw1.transmode.se (gw1.transmode.se [213.115.205.20]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B1019B7BA5 for ; Tue, 6 Oct 2009 10:53:47 +1100 (EST) Received: from sesr04.transmode.se (sesr04.transmode.se [192.168.201.15]) by gw1.transmode.se (Postfix) with ESMTP id EF2C0650001; Tue, 6 Oct 2009 01:53:43 +0200 (CEST) In-Reply-To: <1254782248.7122.49.camel@pasglop> References: <1254744999-3158-1-git-send-email-Joakim.Tjernlund@transmode.se> <20091005220420.GA27923@compile2.chatsunix.int.mrv.com> <1254782248.7122.49.camel@pasglop> Subject: Re: [PATCH 0/6] PowerPc 8xx TLB/MMU fixes X-KeepSent: 2DE63E1A:21EA8BF0-C1257646:0082A7F0; type=4; name=$KeepSent To: Benjamin Herrenschmidt X-Mailer: Lotus Notes Release 8.5 December 05, 2008 Message-ID: From: Joakim Tjernlund Date: Tue, 6 Oct 2009 01:49:36 +0200 X-MIMETrack: Serialize by Router on sesr04/Transmode(Release 8.5 HF407|May 07, 2009) at 2009-10-06 01:53:44 MIME-Version: 1.0 Cc: Scott Wood , "linuxppc-dev@ozlabs.org" , Rex Feany X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Benjamin Herrenschmidt wrote on 06/10/2009 00:37:28: > > On Tue, 2009-10-06 at 00:31 +0200, Joakim Tjernlund wrote: > > > > regs or regs->nip is NULL? Either one does not make sense > > In any case it might be a secondary problem as DAR is NULL already > > when you > > enter the page fault. > > > > > > insn = *((unsigned long *)regs->nip); > > > c000e110: 80 a9 00 00 lwz r5,0(r9) > > > > > > fails. > > > > hmm, I wonder if you managed to invalidate the a kernel TLB? > > Are you using pinned kernel TLBs? > > You should not dereference a user address like that. Use get_user ! So how does this look? Does it change anything? It should as the previous way was way off :( diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index c33c6de..08a392f 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -153,7 +153,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address, #ifdef DEBUG_DCBX const char *istr = NULL; - insn = *((unsigned long *)regs->nip); + __get_user(insn, (unsigned long __user *)regs->nip); if (((insn >> (31-5)) & 0x3f) == 31) { if (((insn >> 1) & 0x3ff) == 1014) /* dcbz ? 0x3f6 */ istr = "dcbz"; @@ -178,11 +178,12 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address, ra, rb, dar); is_write = 0; } - +#if 0 if (trap == 0x300 && address != dar) { __asm__ ("mtdar %0" : : "r" (dar)); return 0; } +#endif } } #endif @@ -191,7 +192,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address, /* This is from a dcbX or icbi insn gone bad, these * insn do not set DAR so we have to do it here instead */ - insn = *((unsigned long *)regs->nip); + __get_user(insn, (unsigned long __user *)regs->nip); ra = (insn >> (31-15)) & 0x1f; /* Reg RA */ rb = (insn >> (31-20)) & 0x1f; /* Reg RB */