Re: Fwd: Problem with set_memory_rw

From: Nick Piggin
Date: Thu Feb 04 2010 - 04:13:01 EST


On Thu, Feb 04, 2010 at 05:51:33PM +0900, KAMEZAWA Hiroyuki wrote:
> On Thu, 4 Feb 2010 10:09:57 +0200
> Oleg Kutkov <elenbert@xxxxxxxxx> wrote:
> > Thank for answer!
> > But this is a very strange, because 0x0509940 - 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. 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.
> >
>
> Below is only about virt_to_page() etc... (not about set_memory_rw())
> Maybe my answer for set_memory_rw() was pointless.
>
> I think system call table is on .rodata section and set_memory_rw() doesn't
> allow change attributes on .rodata sections(not .text)
> ..I'm sorry if I'm wrong.

You are right. static_protections() forbids rodata from being marked RW.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/