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
@@ -2072,6 +2072,10 @@ static void read_symbols(char *modname)
 					   "license", license);
 	}
 
+	/* Livepatch modules have unresolved symbols resolved by klp-convert */
+	if (get_modinfo(info.modinfo, info.modinfo_len, "livepatch"))
+		mod->livepatch = 1;
+
 	for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
 		symname = remove_dot(info.strtab + sym->st_name);
 
@@ -2282,7 +2286,7 @@ static int add_versions(struct buffer *b
 	for (s = mod->unres; s; s = s->next) {
 		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
@@ -117,6 +117,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;