stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] module: weaken locking assertion for oops path." failed to apply to 4.1-stable tree
@ 2015-08-14  1:15 gregkh
  2015-08-15  3:30 ` Rusty Russell
  0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2015-08-14  1:15 UTC (permalink / raw)
  To: rusty, hekuang, peterz; +Cc: stable


The patch below does not apply to the 4.1-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

>From fe0d34d242fa1e0dec059e774d146a705420bc9a Mon Sep 17 00:00:00 2001
From: Rusty Russell <rusty@rustcorp.com.au>
Date: Wed, 29 Jul 2015 05:52:14 +0930
Subject: [PATCH] module: weaken locking assertion for oops path.

We don't actually hold the module_mutex when calling find_module_all
from module_kallsyms_lookup_name: that's because it's used by the oops
code and we don't want to deadlock.

However, access to the list read-only is safe if preempt is disabled,
so we can weaken the assertion.  Keep a strong version for external
callers though.

Fixes: 0be964be0d45 ("module: Sanitize RCU usage and locking")
Reported-by: He Kuang <hekuang@huawei.com>
Cc: stable@kernel.org
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

diff --git a/kernel/module.c b/kernel/module.c
index 4d2b82e610e2..b86b7bf1be38 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -602,13 +602,16 @@ const struct kernel_symbol *find_symbol(const char *name,
 }
 EXPORT_SYMBOL_GPL(find_symbol);
 
-/* Search for module by name: must hold module_mutex. */
+/*
+ * Search for module by name: must hold module_mutex (or preempt disabled
+ * for read-only access).
+ */
 static struct module *find_module_all(const char *name, size_t len,
 				      bool even_unformed)
 {
 	struct module *mod;
 
-	module_assert_mutex();
+	module_assert_mutex_or_preempt();
 
 	list_for_each_entry(mod, &modules, list) {
 		if (!even_unformed && mod->state == MODULE_STATE_UNFORMED)
@@ -621,6 +624,7 @@ static struct module *find_module_all(const char *name, size_t len,
 
 struct module *find_module(const char *name)
 {
+	module_assert_mutex();
 	return find_module_all(name, strlen(name), false);
 }
 EXPORT_SYMBOL_GPL(find_module);


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: FAILED: patch "[PATCH] module: weaken locking assertion for oops path." failed to apply to 4.1-stable tree
  2015-08-14  1:15 FAILED: patch "[PATCH] module: weaken locking assertion for oops path." failed to apply to 4.1-stable tree gregkh
@ 2015-08-15  3:30 ` Rusty Russell
  2015-08-15 15:57   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Rusty Russell @ 2015-08-15  3:30 UTC (permalink / raw)
  To: gregkh, hekuang, peterz; +Cc: stable

gregkh@linuxfoundation.org writes:
> The patch below does not apply to the 4.1-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.

Hi Greg,

        That's OK.  But a question: this was implied by the Fixes: tag;
is there a better way to say "you need this IFF you have that"?

Thanks,
Rusty.

> ------------------ original commit in Linus's tree ------------------
>
>>>From fe0d34d242fa1e0dec059e774d146a705420bc9a Mon Sep 17 00:00:00 2001
> From: Rusty Russell <rusty@rustcorp.com.au>
> Date: Wed, 29 Jul 2015 05:52:14 +0930
> Subject: [PATCH] module: weaken locking assertion for oops path.
>
> We don't actually hold the module_mutex when calling find_module_all
> from module_kallsyms_lookup_name: that's because it's used by the oops
> code and we don't want to deadlock.
>
> However, access to the list read-only is safe if preempt is disabled,
> so we can weaken the assertion.  Keep a strong version for external
> callers though.
>
> Fixes: 0be964be0d45 ("module: Sanitize RCU usage and locking")
> Reported-by: He Kuang <hekuang@huawei.com>
> Cc: stable@kernel.org
> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
>
> diff --git a/kernel/module.c b/kernel/module.c
> index 4d2b82e610e2..b86b7bf1be38 100644
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -602,13 +602,16 @@ const struct kernel_symbol *find_symbol(const char *name,
>  }
>  EXPORT_SYMBOL_GPL(find_symbol);
>  
> -/* Search for module by name: must hold module_mutex. */
> +/*
> + * Search for module by name: must hold module_mutex (or preempt disabled
> + * for read-only access).
> + */
>  static struct module *find_module_all(const char *name, size_t len,
>  				      bool even_unformed)
>  {
>  	struct module *mod;
>  
> -	module_assert_mutex();
> +	module_assert_mutex_or_preempt();
>  
>  	list_for_each_entry(mod, &modules, list) {
>  		if (!even_unformed && mod->state == MODULE_STATE_UNFORMED)
> @@ -621,6 +624,7 @@ static struct module *find_module_all(const char *name, size_t len,
>  
>  struct module *find_module(const char *name)
>  {
> +	module_assert_mutex();
>  	return find_module_all(name, strlen(name), false);
>  }
>  EXPORT_SYMBOL_GPL(find_module);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: FAILED: patch "[PATCH] module: weaken locking assertion for oops path." failed to apply to 4.1-stable tree
  2015-08-15  3:30 ` Rusty Russell
@ 2015-08-15 15:57   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2015-08-15 15:57 UTC (permalink / raw)
  To: Rusty Russell; +Cc: hekuang, peterz, stable

On Sat, Aug 15, 2015 at 01:00:42PM +0930, Rusty Russell wrote:
> gregkh@linuxfoundation.org writes:
> > The patch below does not apply to the 4.1-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <stable@vger.kernel.org>.
> 
> Hi Greg,
> 
>         That's OK.  But a question: this was implied by the Fixes: tag;
> is there a better way to say "you need this IFF you have that"?

You did it correctly, it was just odd to see something marked for stable
for a fixes tag of something that showed up in 4.2-rc1, so I thought it
was prudent to let you know this didn't apply.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-15 15:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-14  1:15 FAILED: patch "[PATCH] module: weaken locking assertion for oops path." failed to apply to 4.1-stable tree gregkh
2015-08-15  3:30 ` Rusty Russell
2015-08-15 15:57   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).