From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [PATCH] enable to read region 5 from /dev/kmem
Date: Tue, 12 Jul 2005 07:18:28 +0000 [thread overview]
Message-ID: <42D36EC4.6070204@jp.fujitsu.com> (raw)
In-Reply-To: <42C501CD.4010907@jp.fujitsu.com>
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 <kamezawa.hiroyu@jp.fujitsu.com>
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
next prev parent reply other threads:[~2005-07-12 7:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-01 8:41 [PATCH] enable to read region 5 from /dev/kmem KAMEZAWA Hiroyuki
2005-07-11 23:02 ` Luck, Tony
2005-07-12 0:14 ` KAMEZAWA Hiroyuki
2005-07-12 0:22 ` Chen, Kenneth W
2005-07-12 1:16 ` KAMEZAWA Hiroyuki
2005-07-12 7:18 ` KAMEZAWA Hiroyuki [this message]
2005-07-12 17:14 ` Luck, Tony
2005-07-12 18:23 ` david mosberger
2005-07-12 19:05 ` Luck, Tony
2005-07-12 21:39 ` david mosberger
2005-07-12 22:08 ` Luck, Tony
2005-07-13 0:33 ` KAMEZAWA Hiroyuki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42D36EC4.6070204@jp.fujitsu.com \
--to=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-ia64@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.