Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4416965imm; Mon, 8 Oct 2018 22:22:12 -0700 (PDT) X-Google-Smtp-Source: ACcGV63S3EuA17l90nwAX9AfrJFIfA/pDwPiv5U0+A62om6L9gxxJCAfmO4iWed56QT5DU1v2g95 X-Received: by 2002:a63:a40a:: with SMTP id c10-v6mr24421478pgf.140.1539062532820; Mon, 08 Oct 2018 22:22:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539062532; cv=none; d=google.com; s=arc-20160816; b=mthFE3Ro4rUPdIdCkfkNDhNnKC3mKkag0NjcWU2QPHEASC8/4AM77hn/uiCZmXLCxq ylcMZjdensTkgGpLviU+otiNB78XBiHfhXoQWPo6kAja9m8oBS/DzWtJ7fWJV/cj8fVU f9patmeXxNpJpwEdv2LLQbGIJcTWu3sbXNvEPxiAzkRqjXfQaIRKgcJNiiABaY16r5oS 09Dm+2m0D7xqtjH5p50so+yEKp8nVFtSusRgqzBjq15w9Zlewzng6+1iP4smrjwyX4wl d9NvF+lBK3HzvG9WxAEzb25kTTfCe8H9HecDT6/g8Klg+QBlCBX+AXX321/WIuTqKCir eSfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:message-id; bh=yyVZVVS565GpeM7h0q5UMc9hSEw/wAxZ/+LatB3Q2Zc=; b=iTmPCwL1TSxgnmQ2yFMXGmZ6+MrBsy45KGL2bZKdbmRh4RJsNT4uGbWqhuGspXtUro oREv/HQVi+MRjpnB1Nfn+1RFe6iARUtG+Z2ybO0yM7Tos0k8gzaI1aopiYRuLZhBFNsc J474Ua04d4Jycpv0NYsujS3JXgxlOND9gpMdDNTGPKWNtfXONXMfijxan/9eT5fCAsvr JVYsJ36UlOsoieIIASQnkWC2O25Ti6Uii3fkcrt019xZA2qS+82amuHRKcLxkgt9Gbce ItzV5CDTVizcAYGkOfeqVytLykKGvAK+kJvNBCFiFcK+GJVPWmfvPyGeQ7p+fOaFh61u bmSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k8-v6si19621176plt.176.2018.10.08.22.21.57; Mon, 08 Oct 2018 22:22:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726488AbeJIMgk (ORCPT + 99 others); Tue, 9 Oct 2018 08:36:40 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:4147 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725808AbeJIMgk (ORCPT ); Tue, 9 Oct 2018 08:36:40 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 42TlvP5MPjz9ttBx; Tue, 9 Oct 2018 07:21:21 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id OrncMcDnVY6l; Tue, 9 Oct 2018 07:21:21 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 42TlvP4kqhz9ttBV; Tue, 9 Oct 2018 07:21:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B46298B775; Tue, 9 Oct 2018 07:21:32 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id OGAVjSGuHKpp; Tue, 9 Oct 2018 07:21:32 +0200 (CEST) Received: from pc16082vm.idsi0.si.c-s.fr (unknown [192.168.232.3]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 856638B75B; Tue, 9 Oct 2018 07:21:32 +0200 (CEST) Received: by pc16082vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 6B5D36F2C6; Tue, 9 Oct 2018 05:21:32 +0000 (UTC) Message-Id: <42e7e2e9b74af526523fb5a1451fdb29cfe2687a.1539060806.git.christophe.leroy@c-s.fr> From: Christophe Leroy Subject: [PATCH] powerpc/mm: make NULL pointer deferences explicit on bad page faults. To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Tue, 9 Oct 2018 05:21:32 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As several other arches including x86, this patch makes it explicit that a bad page fault is a NULL pointer dereference when the fault address is lower than PAGE_SIZE Signed-off-by: Christophe Leroy --- arch/powerpc/mm/fault.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index d51cf5f4e45e..501a1eadb3e9 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -631,13 +631,16 @@ void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig) switch (TRAP(regs)) { case 0x300: case 0x380: - printk(KERN_ALERT "Unable to handle kernel paging request for " - "data at address 0x%08lx\n", regs->dar); + pr_alert("Unable to handle kernel %s for data at address 0x%08lx\n", + regs->dar < PAGE_SIZE ? "NULL pointer dereference" : + "paging request", + regs->dar); break; case 0x400: case 0x480: - printk(KERN_ALERT "Unable to handle kernel paging request for " - "instruction fetch\n"); + pr_alert("Unable to handle kernel %s for instruction fetch\n", + regs->nip < PAGE_SIZE ? "NULL pointer dereference" : + "paging request"); break; case 0x600: printk(KERN_ALERT "Unable to handle kernel paging request for " -- 2.13.3