Skip to contentSkip to conversation

FAILED: patch "[PATCH] module: weaken locking assertion for oops path." failed to apply to 4.1-stable tree

PATCH [email protected] 2 participants 3 messages Aug 14, 2015 – Aug 15, 2015 Stable branch

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

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 <[email protected]>.

thanks,

greg k-h

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

Quoted 1 line

From fe0d34d242fa1e0dec059e774d146a705420bc9a Mon Sep 17 00:00:00 2001

From: Rusty Russell <[email protected]>
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")
kernel/module.c +6 -2
index 4d2b82e610e2..b86b7bf1be38 100644
@@ -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);
#1 lore raw
Quoted 4 lines · [email protected] 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 <[email protected]>.

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.

Quoted 52 lines

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

Quoted 1 line
Quoted 1 line

From fe0d34d242fa1e0dec059e774d146a705420bc9a Mon Sep 17 00:00:00 2001

From: Rusty Russell <[email protected]>
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")
kernel/module.c +6 -2
index 4d2b82e610e2..b86b7bf1be38 100644
@@ -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);
author maintainer
#2 lore raw
Quoted 10 lines · Rusty Russell
Quoted 4 lines · [email protected] 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 <[email protected]>.

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