howto set some kernel pages to readonly?

Russell King - ARM Linux linux at arm.linux.org.uk
Thu Apr 7 18:04:07 EDT 2011


On Thu, Apr 07, 2011 at 08:26:36PM +0200, Peter Wächtler wrote:
> Hello Linux ARM developers,
> 
> on Linux x86 there is infrastructure to set rodata to, aeh, readonly. ;)
> 
> I also want to protect some pages to readonly  as a guard.
> So if some kernel code writes to the memory the kernel panics.
> 
> I tried the following without success:
> 
> And I have to admit that I don't understand all the macros for 
> manipulating the page table entries ;(
> Any clue what's wrong?

We don't map kernel space using pages, but section mappings which have a
granularity of 1MB.

That makes it difficult to set read-only status on just small areas of
memory because you'd have to ensure that the .rodata starts at a 1MB
boundary, and the following data also starts at a 1MB boundary - which
would be quite wasteful.



More information about the linux-arm-kernel mailing list