Received: from milmhbs1.lsil.com (147.145.21.209) by coscas01.lsi.com
 (172.21.36.60) with Microsoft SMTP Server id 8.1.393.1; Wed, 2 Sep 2009
 16:49:12 -0600
Received: from mail2.lsil.com (mail2.lsil.com [147.145.40.22])	by
 milmhbs1.lsil.com (8.12.11/8.12.11) with ESMTP id n82MnAMY020574	for
 <andy.sharp@lsi.com>; Wed, 2 Sep 2009 15:49:12 -0700
Received: from psmtp.com (exprod7mx198.postini.com [64.18.2.90])	by
 mail2.lsil.com (8.12.11/8.12.11) with SMTP id n82MjjC7029442	for
 <andy.sharp@lsi.com>; Wed, 2 Sep 2009 15:45:56 -0700 (PDT)
Received: from source ([78.24.191.182]) by exprod7mx198.postini.com
 ([64.18.6.14]) with SMTP;	Wed, 02 Sep 2009 15:49:09 PDT
Received: from localhost.localdomain ([127.0.0.1]:45065 "EHLO
	eddie.linux-mips.org" rhost-flags-OK-OK-OK-FAIL) by ftp.linux-mips.org	with
 ESMTP id S1492916AbZIBWsf (ORCPT <rfc822;andy.sharp@lsi.com>);	Thu, 3 Sep
 2009 00:48:35 +0200
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 03 Sep 2009 00:48:18
 +0200 (CEST)
Received: from mail3.caviumnetworks.com ([12.108.191.235]:13126 "EHLO
	mail3.caviumnetworks.com" rhost-flags-OK-OK-OK-OK)	by ftp.linux-mips.org with
 ESMTP id S1492317AbZIBWsL (ORCPT	<rfc822;linux-mips@linux-mips.org>); Thu, 3
 Sep 2009 00:48:11 +0200
Received: from caexch01.caveonetworks.com (Not Verified[192.168.16.9]) by
 mail3.caviumnetworks.com with MailMarshal (v6,2,2,3503)	id <B4a9ef60a0000>;
 Wed, 02 Sep 2009 18:47:40 -0400
Received: from caexch01.caveonetworks.com ([192.168.16.9]) by
 caexch01.caveonetworks.com with Microsoft SMTPSVC(6.0.3790.3959);	 Wed, 2 Sep
 2009 15:47:41 -0700
Received: from dd1.caveonetworks.com ([64.169.86.201]) by
 caexch01.caveonetworks.com over TLS secured channel with Microsoft
 SMTPSVC(6.0.3790.3959);	 Wed, 2 Sep 2009 15:47:41 -0700
Received: from dd1.caveonetworks.com (localhost.localdomain [127.0.0.1])	by
 dd1.caveonetworks.com (8.14.2/8.14.2) with ESMTP id n82MlaoI021293;	Wed, 2
 Sep 2009 15:47:36 -0700
Received: (from ddaney@localhost)	by dd1.caveonetworks.com
 (8.14.2/8.14.2/Submit) id n82MlZ0J021292;	Wed, 2 Sep 2009 15:47:35 -0700
From: David Daney <ddaney@caviumnetworks.com>
To: "linux-mips@linux-mips.org" <linux-mips@linux-mips.org>,
	"ralf@linux-mips.org" <ralf@linux-mips.org>
CC: David Daney <ddaney@caviumnetworks.com>
Sender: "linux-mips-bounce@linux-mips.org" <linux-mips-bounce@linux-mips.org>
Date: Wed, 2 Sep 2009 16:47:34 -0600
Subject: [PATCH] MIPS: Don't corrupt page tables on vmalloc fault.
Thread-Topic: [PATCH] MIPS: Don't corrupt page tables on vmalloc fault.
Thread-Index: AcosH5fUdLMrE01ZRkmTWRWxpC1zyQ==
Message-ID: <1251931654-21268-1-git-send-email-ddaney@caviumnetworks.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Exchange-Organization-AuthAs: Anonymous
X-MS-Exchange-Organization-AuthSource: coscas01.lsi.com
X-MS-Has-Attach:
X-Auto-Response-Suppress: All
X-MS-TNEF-Correlator:
x-originalarrivaltime: 02 Sep 2009 22:47:41.0243 (UTC)
 FILETIME=[60C238B0:01CA2C1F]
x-scanned-by: MIMEDefang 2.39
errors-to: linux-mips-bounce@linux-mips.org
x-pstn-neptune: 0/0/0.00/0
x-pstn-levels: (S:59.86825/99.90000 CV:99.9000 FC:95.5390 LC:95.5390
 R:95.9108 P:95.9108 M:97.0282 C:98.6951 )
x-pstn-settings: 3 (1.0000:1.0000) s cv gt3 gt2 gt1 r p m c 
x-pstn-addresses: from <ddaney@caviumnetworks.com> [db-null] 
x-archive-position: 23975
x-ecartis-version: Ecartis v1.0.0
x-original-sender: ddaney@caviumnetworks.com
x-list: linux-mips
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

The code after the vmalloc_fault: label in do_page_fault() modifies
user page tables, this is not correct for 64-bit kernels.

For 64-bit kernels we should go straight to the no_context handler
skipping vmalloc_fault.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 arch/mips/mm/fault.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index f956ecb..e97a7a2 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -58,11 +58,17 @@ asmlinkage void do_page_fault(struct pt_regs *regs, uns=
igned long write,
 	 * only copy the information from the master page table,
 	 * nothing more.
 	 */
+#ifdef CONFIG_64BIT
+# define VMALLOC_FAULT_TARGET no_context
+#else
+# define VMALLOC_FAULT_TARGET vmalloc_fault
+#endif
+
 	if (unlikely(address >=3D VMALLOC_START && address <=3D VMALLOC_END))
-		goto vmalloc_fault;
+		goto VMALLOC_FAULT_TARGET;
 #ifdef MODULE_START
 	if (unlikely(address >=3D MODULE_START && address < MODULE_END))
-		goto vmalloc_fault;
+		goto VMALLOC_FAULT_TARGET;
 #endif
=20
 	/*
@@ -203,6 +209,7 @@ do_sigbus:
 	force_sig_info(SIGBUS, &info, tsk);
=20
 	return;
+#ifndef CONFIG_64BIT
 vmalloc_fault:
 	{
 		/*
@@ -241,4 +248,5 @@ vmalloc_fault:
 			goto no_context;
 		return;
 	}
+#endif
 }
--=20
1.6.0.6


