mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jessica Yu <jeyu@redhat.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Kees Cook <keescook@google.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Laura Abbott <labbott@fedoraproject.org>
Subject: Re: Adding module support for __ro_after_init
Date: Tue, 7 Jun 2016 02:42:10 -0400	[thread overview]
Message-ID: <20160607064210.GA13671@packer-debian-8-amd64.digitalocean.com> (raw)
In-Reply-To: <87fuss6x3f.fsf@rustcorp.com.au>

+++ Rusty Russell [05/06/16 14:39 +0930]:
>Kees Cook <keescook@google.com> writes:
>> Hi Rusty,
>>
>> I'd love to get your thoughts on the best way to support
>> __ro_after_init markings for modules. Are the r/o markings done after
>> module __init runs? If so, this should make things easy, and then we
>> just need to move .data..ro_after_init into .rodata at link time. If
>> not, then we'd need to explicitly make this section read-only after
>> _init.
>
>As you might expect, the sections are made read-only before anything
>runs.  We'll need to do the latter, which means it needs to be
>page-aligned.  (Well we could put it in the same page as .rodata, and
>just not protect that fully until after init).

Hi Rusty, Kees, :-)

Right, RO protection is enabled in load_module() before module __init gets to
run. So I guess there are two ways to go about this: either (1) keep
__ro_after_init with the rest of rodata and toggle RO protection after __init
runs, but I think we'd probably want to keep this protection before anything
executes. Or (2) modify layout_sections() in the module loader to place
.data..ro_after_init data in its own set of page(s) so that we can toggle RO
on/off independently of the other module sections, and set them to RO only
after module init runs.
So perhaps the modified module memory layout might look like..
   [text] [rodata] [ro after init] [writable data]

I don't think (2) should be hard to implement in the module loader (well,
at first glance :-), maybe I'm missing something), but I could go ahead and
give a patch a shot.

Jessica

  reply	other threads:[~2016-06-07  6:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-03 18:46 Kees Cook
2016-06-05  5:09 ` Rusty Russell
2016-06-07  6:42   ` Jessica Yu [this message]
2016-06-07 15:53     ` Kees Cook

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=20160607064210.GA13671@packer-debian-8-amd64.digitalocean.com \
    --to=jeyu@redhat.com \
    --cc=keescook@google.com \
    --cc=labbott@fedoraproject.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®