Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1237166
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: rwx mapping between ex_table and rodata |
| Date | 2015-10-01 11:20 +0200 |
| Message-ID | <qeIbU-8aj-9@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <qclCO-5zE-9@gated-at.bofh.it> <qcnbz-7Zv-11@gated-at.bofh.it> <qdHrA-1Q9-15@gated-at.bofh.it> <qdLlw-7nn-3@gated-at.bofh.it> <qeI2d-7Z7-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
* Thomas Gleixner <tglx@linutronix.de> wrote: > 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. So I think at minimum we should do a (debug) scan in late init, of the whole range, for any leftover WX permissions? That would have caught this bug. (and might catch other existing bugs that might occur with various configs/hw-layouts.) Thanks, Ingo -- 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/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: rwx mapping between ex_table and rodata Kees Cook <keescook@chromium.org> - 2015-09-25 00:30 +0200
Re: rwx mapping between ex_table and rodata Ingo Molnar <mingo@kernel.org> - 2015-09-25 09:30 +0200
Re: rwx mapping between ex_table and rodata Ingo Molnar <mingo@kernel.org> - 2015-09-25 09:30 +0200
Re: rwx mapping between ex_table and rodata Kees Cook <keescook@chromium.org> - 2015-09-26 18:50 +0200
Re: rwx mapping between ex_table and rodata "H. Peter Anvin" <hpa@zytor.com> - 2015-09-28 23:20 +0200
Re: rwx mapping between ex_table and rodata Kees Cook <keescook@chromium.org> - 2015-09-29 00:10 +0200
Re: rwx mapping between ex_table and rodata "H. Peter Anvin" <hpa@zytor.com> - 2015-09-29 00:30 +0200
Re: rwx mapping between ex_table and rodata Stephen Smalley <sds@tycho.nsa.gov> - 2015-09-28 16:20 +0200
Re: rwx mapping between ex_table and rodata Kees Cook <keescook@chromium.org> - 2015-09-28 20:30 +0200
Re: rwx mapping between ex_table and rodata Ingo Molnar <mingo@kernel.org> - 2015-10-01 09:20 +0200
Re: rwx mapping between ex_table and rodata Thomas Gleixner <tglx@linutronix.de> - 2015-10-01 11:10 +0200
Re: rwx mapping between ex_table and rodata Ingo Molnar <mingo@kernel.org> - 2015-10-01 11:20 +0200
Re: rwx mapping between ex_table and rodata Kees Cook <keescook@chromium.org> - 2015-10-01 19:50 +0200
Re: rwx mapping between ex_table and rodata Ingo Molnar <mingo@kernel.org> - 2015-10-02 09:20 +0200
csiph-web