lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161026080914.5bc68d0d@gandalf.local.home>
Date:   Wed, 26 Oct 2016 08:09:14 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Rusty Russell <rusty@...tcorp.com.au>
Cc:     Aaron Tomlin <atomlin@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 2/2] module: When modifying a module's text ignore
 modules which are going away too

On Wed, 26 Oct 2016 11:35:18 +1030
Rusty Russell <rusty@...tcorp.com.au> wrote:

> Aaron Tomlin <atomlin@...hat.com> writes:
> > By default, during the access permission modification of a module's core
> > and init pages, we only ignore modules that are malformed. There is no
> > reason not to extend this to modules which are going away too.  
> 
> Well, it depends on all the callers (ie. ftrace): is that also ignoring
> modules which are going away?
> 
> Otherwise, we set MODULE_STATE_GOING, ftrace walks all the modules and
> this one is still RO...
> 

Actually, looking into this more, you are correct. There's a
possibility in enabling ftrace after the module is about to go but
before ftrace_release_mod() is called (which will remove the module
text from the ftrace function list).

I don't see any reason for not allowing set_all_modules_text_rw() from
being called if a module is going. If a module is going, shouldn't its
text be rw anyway?

Perhaps just preventing it from turning into ro will be sufficient. And
remove the check from set_all_modules_text_rw().

-- Steve


> Thanks,
> Rusty.
> 
> > This patch makes both set_all_modules_text_rw() and
> > set_all_modules_text_ro() skip modules which are going away too.
> >
> > Signed-off-by: Aaron Tomlin <atomlin@...hat.com>
> > ---
> >  kernel/module.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/kernel/module.c b/kernel/module.c
> > index ff93ab8..09c386b 100644
> > --- a/kernel/module.c
> > +++ b/kernel/module.c
> > @@ -1953,7 +1953,8 @@ void set_all_modules_text_rw(void)
> >  
> >  	mutex_lock(&module_mutex);
> >  	list_for_each_entry_rcu(mod, &modules, list) {
> > -		if (mod->state == MODULE_STATE_UNFORMED)
> > +		if (mod->state == MODULE_STATE_UNFORMED ||
> > +			mod->state == MODULE_STATE_GOING)
> >  			continue;
> >  
> >  		frob_text(&mod->core_layout, set_memory_rw);
> > @@ -1969,7 +1970,8 @@ void set_all_modules_text_ro(void)
> >  
> >  	mutex_lock(&module_mutex);
> >  	list_for_each_entry_rcu(mod, &modules, list) {
> > -		if (mod->state == MODULE_STATE_UNFORMED)
> > +		if (mod->state == MODULE_STATE_UNFORMED ||
> > +			mod->state == MODULE_STATE_GOING)
> >  			continue;
> >  
> >  		frob_text(&mod->core_layout, set_memory_ro);
> > -- 
> > 2.5.5  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ