userspace mptable parsing broken in 2.6
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
Quoted 9 lines · Dave Jones
Reading from some parts of
/dev/memis 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/memfor theDEBUG_PAGEALLOCcase. Did you get anywhere with that?
Sorry, I forgot about the issue.
What about the attached patch?
--
Manfred
drivers/char/mem.c +33 -1
@@ -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; }
Quoted 10 lines · Manfred Spraul
Quoted 8 lines
Reading from some parts of
/dev/memis 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/memfor theDEBUG_PAGEALLOCcase. 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