Date: Wed, 12 Oct 2011 21:12:17 +0530 From: "Jayachandran C." <jchandra@freebsd.org> To: freebsd-mips@freebsd.org Subject: [PATCH] Fix for crash on reading /dev/mem in 64 bit. Message-ID: <CA%2B7sy7BUA3f1N7QpnF-ppD5go5=Vm4o%2Bzz09941Dc=5XXTifhw@mail.gmail.com>
index | next in thread | raw e-mail
[-- Attachment #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.
[-- Attachment #2 --]
diff --git a/sys/mips/mips/mem.c b/sys/mips/mips/mem.c
index 7529a9e..d40c424 100644
--- a/sys/mips/mips/mem.c
+++ b/sys/mips/mips/mem.c
@@ -87,6 +87,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
GIANT_REQUIRED;
+ pmap_page_init(&m);
while (uio->uio_resid > 0 && !error) {
iov = uio->uio_iov;
if (iov->iov_len == 0) {
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2B7sy7BUA3f1N7QpnF-ppD5go5=Vm4o%2Bzz09941Dc=5XXTifhw>
