Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1508747

Re: [RFC PATCH 2/2] module: When modifying a module's text ignore modules which are going away too

From Rusty Russell <rusty@rustcorp.com.au>
Newsgroups linux.kernel
Subject Re: [RFC PATCH 2/2] module: When modifying a module's text ignore modules which are going away too
Date 2016-10-26 03:40 +0200
Message-ID <swlma-58c-17@gated-at.bofh.it> (permalink)
References <suoet-1uW-3@gated-at.bofh.it> <suoeu-1uW-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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...

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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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