mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Petr Mladek <pmladek@suse.com>
Cc: Jessica Yu <jeyu@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Jiri Kosina <jikos@kernel.org>, Miroslav Benes <mbenes@suse.cz>,
	Joe Lawrence <joe.lawrence@redhat.com>,
	linux-kernel@vger.kernel.org, live-patching@vger.kernel.org,
	Johannes Erdfelt <johannes@erdfelt.com>,
	Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH 3/3] module: Improve module __ro_after_init handling
Date: Fri, 14 Jun 2019 13:23:41 -0500	[thread overview]
Message-ID: <20190614182341.sq4yngzmoobsyinq@treble> (raw)
In-Reply-To: <20190614141453.fjtvk7uvux6vcmlp@pathway.suse.cz>

On Fri, Jun 14, 2019 at 04:14:53PM +0200, Petr Mladek wrote:
> > -void __module_enable_ro(const struct module *mod, bool after_init)
> > +static void __module_enable_ro(const struct module *mod)
> >  {
> >  	if (!rodata_enabled)
> >  		return;
> > @@ -1973,15 +1973,15 @@ void __module_enable_ro(const struct module *mod, bool after_init)
> >  
> >  	frob_rodata(&mod->init_layout, set_memory_ro);
> >  
> > -	if (after_init)
> > +	if (mod->state == MODULE_STATE_LIVE)
> >  		frob_ro_after_init(&mod->core_layout, set_memory_ro);
> 
> This works only now because __module_enable_ro() is called only from
> three locations (klp_init_object_loaded(),  complete_formation(),
> and do_init_module(). And they all are called in a well defined order
> from load_module().
> 
> Only the final call in do_init_module() should touch the after_init
> section.
> 
> IMHO, the most clean solutiuon would be to call frob_ro_after_init()
> from extra __module_after_init_enable_ro() or so. This should be
> called only from the single place.

Agreed, that would be better.  I'll be gone for a week but I'll make
these changes when I get back.  Thanks.

-- 
Josh

      reply	other threads:[~2019-06-14 18:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-14  1:07 [PATCH 0/3] module: Livepatch/ftrace fixes Josh Poimboeuf
2019-06-14  1:07 ` [PATCH 1/3] module: Fix livepatch/ftrace module text permissions race Josh Poimboeuf
2019-06-14 21:04   ` Steven Rostedt
2019-06-26  8:22     ` Miroslav Benes
2019-06-26 13:37       ` Petr Mladek
2019-06-26 14:44         ` Thomas Gleixner
2019-06-26 14:52           ` Josh Poimboeuf
2019-06-26 14:59           ` Steven Rostedt
2019-06-14  1:07 ` [PATCH 2/3] module: Add text_mutex lockdep assertions for page attribute changes Josh Poimboeuf
2019-06-14 14:04   ` Petr Mladek
2019-06-14 18:21     ` Josh Poimboeuf
2019-06-14  1:07 ` [PATCH 3/3] module: Improve module __ro_after_init handling Josh Poimboeuf
2019-06-14 14:14   ` Petr Mladek
2019-06-14 18:23     ` Josh Poimboeuf [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=20190614182341.sq4yngzmoobsyinq@treble \
    --to=jpoimboe@redhat.com \
    --cc=jeyu@kernel.org \
    --cc=jikos@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=johannes@erdfelt.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mingo@kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.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

all inboxes | Powered by JetHome®