All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Kutkov <elenbert@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: Problem with set_memory_rw
Date: Thu, 04 Feb 2010 10:42:49 +0200	[thread overview]
Message-ID: <4B6A8889.4070407@gmail.com> (raw)


"KAMEZAWA Hiroyuki" <kamezawa.hiroyu@jp.fujitsu.com 
<mailto:kamezawa.hiroyu@jp.fujitsu.com>> wrote:
> set_memory_rw()'s 1st argument requires virtual address.
> So, you need virtual address of the page you want.
>
>  - phys_to_virt() ... convert physical address to virtual address.
>  - virt_to_phys() ... convert virtual address to physical.
>
> Anyway, RW is vitual address mapping's attribute and not for physical.
>
> Thanks,
> -Kame   
>

Thank for answer!
But this is a very strange, because 0x0509940, i passed, - it a virtual 
memory address (i got it from System.map, this is a system call table, 
on my machine). set_memory_rw return zero, anyway. So i can't continue 
writing to memory. Maybe, system call table is much write protected, so 
i can't change attribute of memory page?
One more interesting thing:

struct page *pg;
pg = virt_to_page(addr);
unsigned long page_addr;
page_addr = (unsigned long) page_address(pg);


addr - this is my virtual address (provided by System.map)
But page_addr got another value!
What wrong?
Sorry, if my questions is to stupid.

P.S. I know, that overwriting system call table is very bad, i just 
experimenting with my own network drivers and i need to replace some 
network system calls..


Best regard,
Oleg.


             reply	other threads:[~2010-02-04  8:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-04  8:42 Oleg Kutkov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-02-04  5:26 Problem with set_memory_rw Oleg Kutkov
2010-02-04  5:45 ` 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=4B6A8889.4070407@gmail.com \
    --to=elenbert@gmail.com \
    --cc=linux-kernel@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.