Messages in this thread | | | Date | Sun, 5 Jul 2009 17:03:06 -0700 | From | Arjan van de Ven <> | Subject | Re: [PATCH v3] RO/NX protection for loadable kernel modules |
| |
On Sun, 5 Jul 2009 19:23:56 -0400 Siarhei Liakh <sliakh.lkml@gmail.com> wrote:
> > By default, the original section layout is preserved and RO/NX is > enforced only for whole pages of same content. > However, when compiled with CONFIG_DEBUG_RODATA=y, the patch > will page-align each group of section to ensure that each page > contains only one type of content mentioned above.
I like it.
A few minor nitpicks below, but again, I like this.
> + > +/* Given a virtual address returns 1 if the address is page-aligned, > + * 0 otherwise */ > +#define PAGE_ALIGNED(ADDR) (((unsigned long) ADDR & \ > + ((1UL << PAGE_SHIFT) - 1UL)) ? \ > + (0) : (1))
there is a #define IS_ALIGNED in include/linux/kernel.h... can that be used either directly or wrapped around?
> + > +/* Given a virtual address returns a virtual page number > + * that contains that address */ > +#define PAGE_NUMBER(ADDR) (((unsigned long) ADDR) >> PAGE_SHIFT)
this is PFN_DOWN() from include/linux/pfn.h
there is also a PFN_UP(), which might be useful in your code where you first round down, and then skip the first page if it's partial... ... might be able to just round up from the start instead...
-- Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
| |