From: Ingo Molnar <mingo@kernel.org>
To: Kees Cook <keescook@chromium.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Stephen Smalley <sds@tycho.nsa.gov>,
"x86@kernel.org" <x86@kernel.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: rwx mapping between ex_table and rodata
Date: Fri, 2 Oct 2015 09:19:07 +0200 [thread overview]
Message-ID: <20151002071907.GB2159@gmail.com> (raw)
In-Reply-To: <CAGXu5jJ2hfL11idexxEw436k8=Jtvmw2WPe_EDtuxF7LP1YTGg@mail.gmail.com>
* Kees Cook <keescook@chromium.org> wrote:
> On Thu, Oct 1, 2015 at 2:12 AM, Ingo Molnar <mingo@kernel.org> wrote:
> >
> > * 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.)
>
> I think this would be great. I'd like to disassociate it from PTDUMP,
> though, since that exposes kernel address to userspace. It'd be nice
> to have the check without also the debugfs entry.
Yeah, so it could still use pretty much the same code, except no registry in
/debug?
Thanks,
Ingo
prev parent reply other threads:[~2015-10-02 7:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-24 20:23 rwx mapping between ex_table and rodata Stephen Smalley
2015-09-24 20:26 ` Fwd: " Stephen Smalley
2015-09-24 22:25 ` Kees Cook
2015-09-25 7:22 ` Ingo Molnar
2015-09-26 16:49 ` Kees Cook
2015-09-28 21:16 ` H. Peter Anvin
2015-09-28 22:05 ` Kees Cook
2015-09-28 22:20 ` H. Peter Anvin
2015-09-25 7:25 ` Ingo Molnar
2015-09-28 14:11 ` Stephen Smalley
2015-09-28 18:27 ` Kees Cook
2015-10-01 7:09 ` Ingo Molnar
2015-10-01 9:03 ` Thomas Gleixner
2015-10-01 9:12 ` Ingo Molnar
2015-10-01 17:45 ` Kees Cook
2015-10-02 7:19 ` Ingo Molnar [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151002071907.GB2159@gmail.com \
--to=mingo@kernel.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sds@tycho.nsa.gov \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.