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
@@ -2137,6 +2137,10 @@ static void read_symbols(const char *mod
namespace = get_next_modinfo(&info, "import_ns", namespace);
}
+ /* 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);
@@ -2275,7 +2279,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
@@ -123,6 +123,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;