lkml.org 
[lkml]   [2009]   [Jul]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v4] RO/NX protection for loadable kernel modules
From
> I like it, you can already put
>
> Acked-by: Arjan van de Ven <arjan@linux.intel.com>

Thanks, I will add this to V5.

...
>> +             /*Set text RO if there are still pages between begin
>> and end*/
>> +             if (end_addr > begin_addr) {
>> +                     pg_count = PFN_DOWN(end_addr - 1) -
>> +                                     PFN_DOWN(begin_addr) + 1;
>> +                     DEBUGP("  RO: 0x%lx %lu\n", begin_addr,
>> pg_count);
>> +                     set_memory_ro(begin_addr, pg_count);
>> +             } else {
...
> I *think* this can be done as
>
> begin_pfn = PFN_UP( (base);
> end_pfn = PFN_DOWN(base + ro_size);
>
> if (end_pfn > begin_pfn)
>        set_memory_ro(begin_pfn >> PAGE_SHIFT, end_pfn - begin_pfn);
>
> (note that I think the +1 you have might be buggy)

The +1 is necessary because of (end_addr - 1). However, I like your
way better, so I will incorporate it in V5.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2009-07-09 00:37    [W:0.063 / U:0.804 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site