public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* userspace mptable parsing broken in 2.6
@ 2004-02-11 12:13 Dave Jones
  2004-02-12 19:28 ` Manfred Spraul
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Jones @ 2004-02-11 12:13 UTC (permalink / raw)
  To: Linux Kernel; +Cc: Manfred Spraul

Reading from some parts of /dev/mem is still broken in 2.6.3rc2,
which breaks at least x86info.

Manfred, in the end of the last thread on this at..
http://www.ussg.iu.edu/hypermail/linux/kernel/0311.1/0373.html
you mentioned you were going to add some code to /dev/mem for the
DEBUG_PAGEALLOC case. Did you get anywhere with that?

		Dave


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: userspace mptable parsing broken in 2.6
  2004-02-11 12:13 userspace mptable parsing broken in 2.6 Dave Jones
@ 2004-02-12 19:28 ` Manfred Spraul
  2004-02-19  3:54   ` Dave Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Manfred Spraul @ 2004-02-12 19:28 UTC (permalink / raw)
  To: Dave Jones; +Cc: Linux Kernel

[-- Attachment #1: Type: text/plain, Size: 445 bytes --]

Dave Jones wrote:

>Reading from some parts of /dev/mem is still broken in 2.6.3rc2,
>which breaks at least x86info.
>
>Manfred, in the end of the last thread on this at..
>http://www.ussg.iu.edu/hypermail/linux/kernel/0311.1/0373.html
>you mentioned you were going to add some code to /dev/mem for the
>DEBUG_PAGEALLOC case. Did you get anywhere with that?
>  
>
Sorry, I forgot about the issue.

What about the attached patch?

--
    Manfred

[-- Attachment #2: patch-debugpagealloc-mem --]
[-- Type: text/plain, Size: 1011 bytes --]

--- 2.6/drivers/char/mem.c	2004-02-08 13:08:30.000000000 +0100
+++ build-2.6/drivers/char/mem.c	2004-02-12 20:10:56.000000000 +0100
@@ -25,6 +25,7 @@
 #include <linux/devfs_fs_kernel.h>
 #include <linux/ptrace.h>
 #include <linux/device.h>
+#include <linux/pagemap.h>
 
 #include <asm/uaccess.h>
 #include <asm/io.h>
@@ -151,10 +152,41 @@
 		}
 	}
 #endif
+#if CONFIG_DEBUG_PAGEALLOC
+	while (count) {
+		size_t i;
+		struct page *page;
+
+		i = PAGE_SIZE - (p%PAGE_SIZE);
+		if (i > count)
+			i = count;
+		if (virt_addr_valid(__va(p))) {
+			page = virt_to_page(__va(p));
+			get_page(page);
+			kernel_map_pages(page, 1, 1);
+		} else {
+			page = NULL;
+		}
+		if (copy_to_user(buf, __va(p), i)) {
+			if (page)
+				put_page(page);
+			return -EFAULT;
+		}
+		if (page)
+			put_page(page);
+		buf += i;
+		p += i;
+		count -= i;
+		read += i;
+	}
+#else
 	if (copy_to_user(buf, __va(p), count))
 		return -EFAULT;
+
+	p += count;
 	read += count;
-	*ppos += read;
+#endif
+	*ppos = p;
 	return read;
 }
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: userspace mptable parsing broken in 2.6
  2004-02-12 19:28 ` Manfred Spraul
@ 2004-02-19  3:54   ` Dave Jones
  0 siblings, 0 replies; 3+ messages in thread
From: Dave Jones @ 2004-02-19  3:54 UTC (permalink / raw)
  To: Manfred Spraul; +Cc: Linux Kernel

On Thu, Feb 12, 2004 at 08:28:04PM +0100, Manfred Spraul wrote:

 > >Reading from some parts of /dev/mem is still broken in 2.6.3rc2,
 > >which breaks at least x86info.
 > >
 > >Manfred, in the end of the last thread on this at..
 > >http://www.ussg.iu.edu/hypermail/linux/kernel/0311.1/0373.html
 > >you mentioned you were going to add some code to /dev/mem for the
 > >DEBUG_PAGEALLOC case. Did you get anywhere with that?
 > >
 > Sorry, I forgot about the issue.
 > What about the attached patch?

Seems to do the right thing here.

		Dave


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-02-19  3:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-11 12:13 userspace mptable parsing broken in 2.6 Dave Jones
2004-02-12 19:28 ` Manfred Spraul
2004-02-19  3:54   ` Dave Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox