Blob Blame History Raw
From: Josh Poimboeuf <jpoimboe@redhat.com>
Subject: modpost: ignore livepatch unresolved relocations
Patch-mainline: Submitted, https://lore.kernel.org/lkml/20170829190140.401-1-jmoreira@suse.de/
References: fate#326849

Make modpost ignore unresolved symbols when handling livepatches. These symbols
are to be taken care of by klp-convert.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Joao Moreira <jmoreira@suse.de>
Signed-off-by: Miroslav Benes <mbenes@suse.cz>

---
 scripts/mod/modpost.c |    6 +++++-
 scripts/mod/modpost.h |    1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -2070,6 +2070,10 @@ static void read_symbols(const char *mod
 		license = get_next_modinfo(&info, "license", license);
 	}
 
+	/* Livepatch modules have unresolved symbols resolved by klp-convert */
+	if (get_modinfo(&info, "livepatch"))
+		mod->livepatch = 1;
+
 	for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
 		symname = remove_dot(info.strtab + sym->st_name);
 
@@ -2197,7 +2201,7 @@ static int check_exports(struct module *
 		const char *basename;
 		exp = find_symbol(s->name);
 		if (!exp || exp->module == mod) {
-			if (have_vmlinux && !s->weak) {
+			if (have_vmlinux && !s->weak && !mod->livepatch) {
 				if (warn_unresolved) {
 					warn("\"%s\" [%s.ko] undefined!\n",
 					     s->name, mod->name);
--- a/scripts/mod/modpost.h
+++ b/scripts/mod/modpost.h
@@ -118,6 +118,7 @@ struct module {
 	int skip;
 	int has_init;
 	int has_cleanup;
+	int livepatch;
 	struct buffer dev_table_buf;
 	char	     srcversion[25];
 	int is_dot_o;