Messages in this thread | | | Date | Fri, 14 Jun 2019 13:23:41 -0500 | From | Josh Poimboeuf <> | Subject | Re: [PATCH 3/3] module: Improve module __ro_after_init handling |
| |
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
| |