linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: js07.lee@gmail.com (Jungseung Lee)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] kernel/module.c: Mark module state before set RO and NX regions
Date: Tue,  6 Jan 2015 18:07:36 +0900	[thread overview]
Message-ID: <1420535256-6091-1-git-send-email-js07.lee@gmail.com> (raw)

In some architectures like arm/arm64, set_memory_*() check module address
and state as well. Mark module state before set RO and NX regions for
the routine is passed.

It will fix wrong RO/NX protection for loadable kernel modules on arm/arm64.

Signed-off-by: Jungseung Lee <js07.lee@gmail.com>
---
 kernel/module.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index 3965511..7e7cc9f 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3152,6 +3152,10 @@ static int complete_formation(struct module *mod, struct load_info *info)
 	/* This relies on module_mutex for list integrity. */
 	module_bug_finalize(info->hdr, info->sechdrs, mod);
 
+	/* Mark state as coming so strong_try_module_get() ignores us,
+	 * but kallsyms etc. can see us. */
+	mod->state = MODULE_STATE_COMING;
+
 	/* Set RO and NX regions for core */
 	set_section_ro_nx(mod->module_core,
 				mod->core_text_size,
@@ -3164,9 +3168,6 @@ static int complete_formation(struct module *mod, struct load_info *info)
 				mod->init_ro_size,
 				mod->init_size);
 
-	/* Mark state as coming so strong_try_module_get() ignores us,
-	 * but kallsyms etc. can see us. */
-	mod->state = MODULE_STATE_COMING;
 	mutex_unlock(&module_mutex);
 
 	blocking_notifier_call_chain(&module_notify_list,
-- 
1.9.1

             reply	other threads:[~2015-01-06  9:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-06  9:07 Jungseung Lee [this message]
2015-01-07  4:16 ` [PATCH] kernel/module.c: Mark module state before set RO and NX regions Rusty Russell
2015-01-07 17:55   ` Laura Abbott
2015-01-08  3:03     ` Jungseung Lee

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=1420535256-6091-1-git-send-email-js07.lee@gmail.com \
    --to=js07.lee@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).