From owner-freebsd-mips@FreeBSD.ORG Wed Oct 12 15:42:19 2011 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 863091065672 for ; Wed, 12 Oct 2011 15:42:19 +0000 (UTC) (envelope-from c.jayachandran@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 19A9B8FC0A for ; Wed, 12 Oct 2011 15:42:18 +0000 (UTC) Received: by wyj26 with SMTP id 26so1263843wyj.13 for ; Wed, 12 Oct 2011 08:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=4XzRZQ/srzmtXLsckBflsiD0c99TTyWJnhTaho7thyo=; b=MsoA7bu1NB0oqsEOlOs2Odod7R3wp1eUIEZDJQEBY983KS19PNrPLFY3V3bDcFeOdy KcSGyBgPiy/AEKLrPi5DREsrZeCFjmuztIQne3UWFkdu4W9b9G2zC0Mw3VWGT+4uI8zo 9+oaDNYYpDoFE0tmerD3PzYEBwdwbCVmjP7Vg= MIME-Version: 1.0 Received: by 10.216.14.201 with SMTP id d51mr9496536wed.56.1318434138188; Wed, 12 Oct 2011 08:42:18 -0700 (PDT) Sender: c.jayachandran@gmail.com Received: by 10.216.188.3 with HTTP; Wed, 12 Oct 2011 08:42:17 -0700 (PDT) Date: Wed, 12 Oct 2011 21:12:17 +0530 X-Google-Sender-Auth: 2bYhh4mz8H53wbB1KMs3ZMRvidE Message-ID: From: "Jayachandran C." To: freebsd-mips@freebsd.org Content-Type: multipart/mixed; boundary=0016364c7e6d776c6704af1bde80 Subject: [PATCH] Fix for crash on reading /dev/mem in 64 bit. X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2011 15:42:19 -0000 --0016364c7e6d776c6704af1bde80 Content-Type: text/plain; charset=ISO-8859-1 The crash happens because memrw() calls uiomove_fromphys() with a vm_page that is allocated in stack. This page does not have the md.pv_list initialized, and when uiomove_fromphys() calls pmap_flush_pvcache(), it results in a kernel crash. The attached patch fixes this bug. Also looking at the code of uiomove_fromphys(), I'm not sure why we need the wbinv and flush pvcache and then another wbinv - any ideas? If there are no comments, I'm planning to check it in later this week. JC. --0016364c7e6d776c6704af1bde80 Content-Type: text/x-patch; charset=US-ASCII; name="mips-dev-mem.patch" Content-Disposition: attachment; filename="mips-dev-mem.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gtohmej60 ZGlmZiAtLWdpdCBhL3N5cy9taXBzL21pcHMvbWVtLmMgYi9zeXMvbWlwcy9taXBzL21lbS5jCmlu ZGV4IDc1MjlhOWUuLmQ0MGM0MjQgMTAwNjQ0Ci0tLSBhL3N5cy9taXBzL21pcHMvbWVtLmMKKysr IGIvc3lzL21pcHMvbWlwcy9tZW0uYwpAQCAtODcsNiArODcsNyBAQCBtZW1ydyhzdHJ1Y3QgY2Rl diAqZGV2LCBzdHJ1Y3QgdWlvICp1aW8sIGludCBmbGFncykKIAogCUdJQU5UX1JFUVVJUkVEOwog CisJcG1hcF9wYWdlX2luaXQoJm0pOwogCXdoaWxlICh1aW8tPnVpb19yZXNpZCA+IDAgJiYgIWVy cm9yKSB7CiAJCWlvdiA9IHVpby0+dWlvX2lvdjsKIAkJaWYgKGlvdi0+aW92X2xlbiA9PSAwKSB7 Cg== --0016364c7e6d776c6704af1bde80--