[SRU][B][PATCH 2/8] UBUNTU: SAUCE: Revert "modules: return licensing information from find_symbol"

Ian May ian.may at canonical.com
Thu Jun 17 20:22:19 UTC 2021


BugLink: https://bugs.launchpad.net/bugs/1932065

This reverts commit e67447e89440ec0241832fde7e095504e63ce58b.

Upstream introduced 'module' patches that removed exported symbols
that might cause potential disruption and breakage for customers.

Reverting as SAUCE patches to prevent regressions.

Signed-off-by: Ian May <ian.may at canonical.com>
---
 include/linux/module.h |  2 +-
 kernel/module.c        | 16 +++++-----------
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/include/linux/module.h b/include/linux/module.h
index 7598c8112c71..0232bef654ed 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -522,7 +522,7 @@ struct module *find_module(const char *name);
 struct symsearch {
 	const struct kernel_symbol *start, *stop;
 	const s32 *crcs;
-	enum mod_license {
+	enum {
 		NOT_GPL_ONLY,
 		GPL_ONLY,
 		WILL_BE_GPL_ONLY,
diff --git a/kernel/module.c b/kernel/module.c
index 2876babeaf8a..d6ae25976cea 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -507,7 +507,6 @@ struct find_symbol_arg {
 	struct module *owner;
 	const s32 *crc;
 	const struct kernel_symbol *sym;
-	enum mod_license license;
 };
 
 static bool check_symbol(const struct symsearch *syms,
@@ -541,7 +540,6 @@ static bool check_symbol(const struct symsearch *syms,
 	fsa->owner = owner;
 	fsa->crc = symversion(syms->crcs, symnum);
 	fsa->sym = &syms->start[symnum];
-	fsa->license = syms->license;
 	return true;
 }
 
@@ -574,7 +572,6 @@ static bool find_symbol_in_section(const struct symsearch *syms,
 static const struct kernel_symbol *find_symbol(const char *name,
 					struct module **owner,
 					const s32 **crc,
-					enum mod_license *license,
 					bool gplok,
 					bool warn)
 {
@@ -589,8 +586,6 @@ static const struct kernel_symbol *find_symbol(const char *name,
 			*owner = fsa.owner;
 		if (crc)
 			*crc = fsa.crc;
-		if (license)
-			*license = fsa.license;
 		return fsa.sym;
 	}
 
@@ -1063,7 +1058,7 @@ void __symbol_put(const char *symbol)
 	struct module *owner;
 
 	preempt_disable();
-	if (!find_symbol(symbol, &owner, NULL, NULL, true, false))
+	if (!find_symbol(symbol, &owner, NULL, true, false))
 		BUG();
 	module_put(owner);
 	preempt_enable();
@@ -1342,7 +1337,7 @@ static inline int check_modstruct_version(const struct load_info *info,
 	 */
 	preempt_disable();
 	if (!find_symbol(VMLINUX_SYMBOL_STR(module_layout), NULL,
-			 &crc, NULL, true, false)) {
+			 &crc, true, false)) {
 		preempt_enable();
 		BUG();
 	}
@@ -1392,7 +1387,6 @@ static const struct kernel_symbol *resolve_symbol(struct module *mod,
 	struct module *owner;
 	const struct kernel_symbol *sym;
 	const s32 *crc;
-	enum mod_license license;
 	int err;
 
 	/*
@@ -1402,7 +1396,7 @@ static const struct kernel_symbol *resolve_symbol(struct module *mod,
 	 */
 	sched_annotate_sleep();
 	mutex_lock(&module_mutex);
-	sym = find_symbol(name, &owner, &crc, &license,
+	sym = find_symbol(name, &owner, &crc,
 			  !(mod->taints & (1 << TAINT_PROPRIETARY_MODULE)), true);
 	if (!sym)
 		goto unlock;
@@ -2221,7 +2215,7 @@ void *__symbol_get(const char *symbol)
 	const struct kernel_symbol *sym;
 
 	preempt_disable();
-	sym = find_symbol(symbol, &owner, NULL, NULL, true, true);
+	sym = find_symbol(symbol, &owner, NULL, true, true);
 	if (sym && strong_try_module_get(owner))
 		sym = NULL;
 	preempt_enable();
@@ -2256,7 +2250,7 @@ static int verify_export_symbols(struct module *mod)
 
 	for (i = 0; i < ARRAY_SIZE(arr); i++) {
 		for (s = arr[i].sym; s < arr[i].sym + arr[i].num; s++) {
-			if (find_symbol(s->name, &owner, NULL, NULL, true, false)) {
+			if (find_symbol(s->name, &owner, NULL, true, false)) {
 				pr_err("%s: exports duplicate symbol %s"
 				       " (owned by %s)\n",
 				       mod->name, s->name, module_name(owner));
-- 
2.25.1




More information about the kernel-team mailing list