lkml.org 
[lkml]   [2015]   [Oct]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: rwx mapping between ex_table and rodata
On Mon, 28 Sep 2015, Kees Cook wrote:
> > --- a/arch/x86/mm/init_64.c
> > +++ b/arch/x86/mm/init_64.c
> > @@ -1132,7 +1132,7 @@ void mark_rodata_ro(void)
> > * has been zapped already via cleanup_highmem().
> > */
> > all_end = roundup((unsigned long)_brk_end, PMD_SIZE);
> > - set_memory_nx(rodata_start, (all_end - rodata_start) >> PAGE_SHIFT);
> > + set_memory_nx(text_end, (all_end - text_end) >> PAGE_SHIFT);
> >
> > rodata_test();
> >
> >
>
> That should work, yeah. I'd still like to find the default permissions
> and make them W+nx, though. Regardless, let's get the above added.

The default permissions are set at boot time when setting up the early
page tables. When we split them up later on we inherit the PTE bits
and then we do that _ro/nx cleanup after the overall layout has been
settled.

We can't make them W+nx in the early setup without shooting ourself in
the foot, because we only set up at the pud/pmd level.

Thanks,

tglx




\
 
 \ /
  Last update: 2015-10-01 11:21    [W:0.105 / U:1.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site