From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ozlabs.org ([103.22.144.67]:41622 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750897AbbHOFt1 (ORCPT ); Sat, 15 Aug 2015 01:49:27 -0400 From: Rusty Russell To: gregkh@linuxfoundation.org, hekuang@huawei.com, peterz@infradead.org Cc: stable@vger.kernel.org Subject: Re: FAILED: patch "[PATCH] module: weaken locking assertion for oops path." failed to apply to 4.1-stable tree In-Reply-To: <1439514956185245@kroah.com> References: <1439514956185245@kroah.com> Date: Sat, 15 Aug 2015 13:00:42 +0930 Message-ID: <87oai9qlct.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain Sender: stable-owner@vger.kernel.org List-ID: 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 . 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 > 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 > Cc: stable@kernel.org > Acked-by: Peter Zijlstra (Intel) > Signed-off-by: Rusty Russell > > 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);