Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1509115
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Steven Rostedt <rostedt@goodmis.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH 2/2] module: When modifying a module's text ignore modules which are going away too |
| Date | Wed, 26 Oct 2016 14:10:02 +0200 |
| Message-ID | <swvbP-3py-3@gated-at.bofh.it> (permalink) |
| References | <suoet-1uW-3@gated-at.bofh.it> <suoeu-1uW-13@gated-at.bofh.it> <swlma-58c-17@gated-at.bofh.it> |
| X-Original-To | Rusty Russell <rusty@rustcorp.com.au> |
| X-Session-Marker | 726F737465647440676F6F646D69732E6F7267 |
| X-Spam-Summary | 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::,RULES_HIT:41:355:379:541:599:800:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1431:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2693:2898:2901:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4419:5007:6120:6261:7875:7903:9010:10004:10400:10848:10967:11026:11232:11473:11658:11914:12438:12555:12740:12760:13190:13229:13255:13439:14096:14097:14181:14659:14721:21080:21324:21433:30045:30054:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none |
| X-He-Tag | pail32_6e16d0e699b2e |
| X-Filterd-Recvd-Size | 3312 |
| X-Mailer | Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 67 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Aaron Tomlin <atomlin@redhat.com>, linux-kernel@vger.kernel.org |
| X-Original-Date | Wed, 26 Oct 2016 08:09:14 -0400 |
| X-Original-Message-ID | <20161026080914.5bc68d0d@gandalf.local.home> |
| X-Original-References | <1476980293-19062-1-git-send-email-atomlin@redhat.com> <1476980293-19062-3-git-send-email-atomlin@redhat.com> <87d1in538x.fsf@rustcorp.com.au> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1509115 |
Show key headers only | View raw
On Wed, 26 Oct 2016 11:35:18 +1030
Rusty Russell <rusty@rustcorp.com.au> wrote:
> Aaron Tomlin <atomlin@redhat.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@redhat.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
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[RFC PATCH 0/2] Possible race between load_module() error handling and kprobe registration ? Aaron Tomlin <atomlin@redhat.com> - 2016-10-20 18:20 +0200
[RFC PATCH 1/2] module: Ensure a module's state is set accordingly during module coming cleanup code Aaron Tomlin <atomlin@redhat.com> - 2016-10-20 18:20 +0200
Re: [RFC PATCH 1/2] module: Ensure a module's state is set accordingly during module coming cleanup code Rusty Russell <rusty@rustcorp.com.au> - 2016-10-26 03:40 +0200
[RFC PATCH 2/2] module: When modifying a module's text ignore modules which are going away too Aaron Tomlin <atomlin@redhat.com> - 2016-10-20 18:20 +0200
Re: [RFC PATCH 2/2] module: When modifying a module's text ignore modules which are going away too Rusty Russell <rusty@rustcorp.com.au> - 2016-10-26 03:40 +0200
Re: [RFC PATCH 2/2] module: When modifying a module's text ignore modules which are going away too Steven Rostedt <rostedt@goodmis.org> - 2016-10-26 14:10 +0200
csiph-web