From patchwork Tue Jan 4 21:40:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 12703882 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4196C433EF for ; Tue, 4 Jan 2022 21:40:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234332AbiADVkU (ORCPT ); Tue, 4 Jan 2022 16:40:20 -0500 Received: from mta-tor-004.bell.net ([209.71.212.31]:19338 "EHLO cmx-torrgo001.bell.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234316AbiADVkT (ORCPT ); Tue, 4 Jan 2022 16:40:19 -0500 X-RG-CM-BuS: 0 X-RG-CM-SC: 0 X-RG-CM: Clean X-Originating-IP: [67.71.8.137] X-RG-Env-Sender: dave.anglin@bell.net X-RG-Rigid: 61C6317800D3EA8A X-CM-Envelope: MS4xfHYTaDA1tS8ze9CKzLOYK9uuSJVSkLIlLz/dtZa0BcrUyapbL3JMUBRdnqZzdO9nNCzXgLBNK3U8Kk0QDuQy0be4bymO2f36aAS5btyM6UwXKEZ6a07q m5qD9oMXvHvk75LZUSAT0YQ2lD7txYROxsxlYQ/CjXvcA9AonG3tw7IC+d6oGpqYMIUfnUfidroMiheIPKQRKqUQKXqbjvOhuWpkmsjGgo0148zFMpHZr/K+ 86+BOPvvV1rbTCw01kUd8w+nK8GVVW51zFM8NrmAwa5Af8b1P3oKZl2VVOqBXk79+LdaHzjrd7pwIhKl5B1E+kmDmwFZpKUmccZZ1zO+AjLkajyIaH9/gv4H yH1ppCWwM+GeFlOCc5DgyaeOoMpLTFfTFbUKpuQvloYa8YFes5Yk7mgSSH+4EAnYWJZK6QzR5UgncUbCgqVveJvoeryZPt0MZq6yGVvitt7Y3DhXCgLXZskx CEt6mRKbSQ0VaqTNnaedCgWnWU1vryvV9lI4NbIOtBJAMk7CC8IhlpClLWfyfsEAK2su5PpxjUfuxIGWxQWdWS00gaAtLlFPA7fJaqbzKc8pGr0drXtclkT2 nKmfCqPSTv1r00u1BUh+zKKY1ADzvRByRLnWZvw/9T2anw== X-CM-Analysis: v=2.4 cv=f44ruM+M c=1 sm=1 tr=0 ts=61d4beb4 a=jrdA9tB8yuRqUzQ1EpSZjA==:117 a=jrdA9tB8yuRqUzQ1EpSZjA==:17 a=DghFqjY3_ZEA:10 a=FBHGMhGWAAAA:8 a=kFL441cg9DsEPG_3uPkA:9 a=CjuIK1q_8ugA:10 a=0Maxw7URQSbRRFcBBY0A:9 a=FfaGCDsud1wA:10 a=9gvnlMMaQFpL9xblJ6ne:22 Received: from mx3210.localdomain (67.71.8.137) by cmx-torrgo001.bell.net (5.8.716.03) (authenticated as dave.anglin@bell.net) id 61C6317800D3EA8A; Tue, 4 Jan 2022 16:40:04 -0500 Received: by mx3210.localdomain (Postfix, from userid 1000) id 38647220117; Tue, 4 Jan 2022 21:40:02 +0000 (UTC) Date: Tue, 4 Jan 2022 21:40:02 +0000 From: John David Anglin To: linux-parisc Cc: Helge Deller , Deller , James Bottomley Subject: [PATCH] parisc: Enhance page fault termination message Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org In debugging kernel panics, I believe it is useful to know what type of page fault caused the termination. "Bad Address" is too vague. Signed-off-by: John David Anglin diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c index 499e2e8f7f34..147868427b7c 100644 --- a/arch/parisc/mm/fault.c +++ b/arch/parisc/mm/fault.c @@ -266,11 +266,14 @@ void do_page_fault(struct pt_regs *regs, unsigned long code, unsigned long acc_type; vm_fault_t fault = 0; unsigned int flags; + char *msg; tsk = current; mm = tsk->mm; - if (!mm) + if (!mm) { + msg = "Page fault: no context"; goto no_context; + } flags = FAULT_FLAG_DEFAULT; if (user_mode(regs)) @@ -406,6 +409,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long code, force_sig_fault(signo, si_code, (void __user *) address); return; } + msg = "Page fault: bad address"; no_context: @@ -413,11 +417,13 @@ void do_page_fault(struct pt_regs *regs, unsigned long code, return; } - parisc_terminate("Bad Address (null pointer deref?)", regs, code, address); + parisc_terminate(msg, regs, code, address); - out_of_memory: +out_of_memory: mmap_read_unlock(mm); - if (!user_mode(regs)) + if (!user_mode(regs)) { + msg = "Page fault: out of memory"; goto no_context; + } pagefault_out_of_memory(); }