From: Jessica Yu <jeyu@redhat.com>
To: Rusty Russell <rusty@rustcorp.com.au>, Kees Cook <keescook@google.com>
Cc: linux-api@vger.kernel.org, linux-kernel@vger.kernel.org,
live-patching@vger.kernel.org, Jessica Yu <jeyu@redhat.com>
Subject: [PATCH v2 0/1] Add ro_after_init support for modules
Date: Mon, 25 Jul 2016 05:25:57 -0400 [thread overview]
Message-ID: <1469438758-24729-1-git-send-email-jeyu@redhat.com> (raw)
Hi,
This patch adds ro_after_init support for modules by adding an additional
page-aligned section in the module layout. This new ro_after_init section
sits between rodata and writable data.
So, the new module layout looks like:
[text] [rodata] [ro_after_init] [writable data]
RO after init data remains RW during init and RO protection is enabled
separately after module init runs.
Did some light testing with lkdtm compiled as a module, verified that
ro_after_init data is writable during init, and that it oopsed after attempted
writes after init. Also tested livepatch (which uses module_{enable,disable}_ro
for its own purposes) to make sure nothing broke. More testing is appreciated :-)
Some remarks on the implementation:
* A new SHF_RO_AFTER_INIT flag is introduced in elf.h to make
identification of .data..ro_after_init sections and the work of
layout_sections() easier. Its chosen value is within the SHF_MASKOS
range.
* If a module doesn't have a ro_after_init section, then
core_layout.ro_after_init_size just takes the value of
core_layout.ro_size, and frob_ro_after_init() should do nothing.
Based on linux-next.
v1 here:
http://lkml.kernel.org/g/1465863198-15947-1-git-send-email-jeyu@redhat.com
v2:
- Add a bool after_init parameter to module_enable_ro(), it's much clearer
than checking module->state.
- Since the function signature for module_enable_ro() has changed, livepatch
needs to slightly adjust its call to module_enable_ro()
Jessica Yu (1):
modules: add ro_after_init support
include/linux/module.h | 6 +++--
include/uapi/linux/elf.h | 1 +
kernel/livepatch/core.c | 2 +-
kernel/module.c | 66 +++++++++++++++++++++++++++++++++++++++---------
4 files changed, 60 insertions(+), 15 deletions(-)
--
2.5.5
next reply other threads:[~2016-07-25 9:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-25 9:25 Jessica Yu [this message]
2016-07-25 9:25 ` [PATCH v2 1/1] modules: add ro_after_init support Jessica Yu
2016-07-25 10:01 ` Jessica Yu
2016-07-25 18:04 ` [PATCH v2 1/1] " 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=1469438758-24729-1-git-send-email-jeyu@redhat.com \
--to=jeyu@redhat.com \
--cc=keescook@google.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@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®