Luck, Tony wrote:
This patch allows users to read region 5 from /dev/kmem and
enhances range check of it.
I'm uneasy about this change to drivers/char/mem.c. Won't it stop
those architectures that have memory at physical 0x0 from accessing
it?
ptr = xlate_dev_mem_ptr(p);
-
+ if (!ptr)
+ return -EFAULT
I confirmed this is not necessary. I send fixed one.
Note:
linux-2.6.13-rc1 panic when "cat /dev/kmem > /dev/null".
I'ts because xlate_dev_kmem_ptr() doesn't uses pfn_valid() to access page
struct.
Thanks,
Kamezawa Hiroyuki.
==
This patch allows to read region 5 of the kernel from /dev/kmem.
Signed-off-by: KAMEZAWA Hiroyuki <[EMAIL PROTECTED]>
Index: linux-2.6.13-rc1/include/asm-ia64/uaccess.h
===================================================================
--- linux-2.6.13-rc1.orig/include/asm-ia64/uaccess.h 2005-07-12
14:40:37.000000000 +0900
+++ linux-2.6.13-rc1/include/asm-ia64/uaccess.h 2005-07-12 15:47:56.000000000
+0900
@@ -395,8 +395,27 @@
{
struct page *page;
char * ptr;
+ unsigned long pfn;
+ int region;
+
+ region = REGION_NUMBER(p);
+
+ switch (region) {
+ case 6:
+ pfn = ((unsigned long)p - __IA64_UNCACHED_OFFSET) >>
PAGE_SHIFT;
+ break;
+ case 7:
+ pfn = __pa(p) >> PAGE_SHIFT;
+ break;
+ default:
+ return p;
+ }
+ if (!pfn_valid(pfn))
+ return NULL; /* cause access error in copy_user */
+ if (region == 6)
+ return p;
+ page = pfn_to_page(pfn);
- page = virt_to_page((unsigned long)p >> PAGE_SHIFT);
if (PageUncached(page))
ptr = (char *)__pa(p) + __IA64_UNCACHED_OFFSET;
else
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html