Skip to contentSkip to conversation

modpost: Reduce the log level and fix the errors causing livepatch failure

PATCH In review [email protected] 2 participants 2 messages Jun 7, 2025 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 modpost: Reduce the log level and fix the errors causing livepatch failure

From: huyubiao <[email protected]>

Since the commit ddb5cdbafaaa ("kbuild: generate KSYMTAB entries by modpost"), modpost has become stricter in handling EXPORT_SYMBOL, making it incompatible with older versions of livepatch builds.

Is the error level too strict? In my opinion, even if there are issues with the use of EXPORT_SYMBOL, they are not necessarily fatal to program execution.

---
 scripts/mod/modpost.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/mod/modpost.c +4 -4
index fb787a5715..13f81392a4 100644
@@ -1055,21 +1055,21 @@ static void check_export_symbol(struct module *mod, struct elf_info *elf,
 	label_name = sym_name(elf, label);
 
 	if (!strstarts(label_name, prefix)) {
-		error("%s: .export_symbol section contains strange symbol '%s'\n",
+		warn("%s: .export_symbol section contains strange symbol '%s'\n",
 		      mod->name, label_name);
 		return;
 	}
 
 	if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL &&
 	    ELF_ST_BIND(sym->st_info) != STB_WEAK) {
-		error("%s: local symbol '%s' was exported\n", mod->name,
+		warn("%s: local symbol '%s' was exported\n", mod->name,
 		      label_name + strlen(prefix));
 		return;
 	}
 
 	name = sym_name(elf, sym);
 	if (strcmp(label_name + strlen(prefix), name)) {
-		error("%s: .export_symbol section references '%s', but it does not seem to be an export symbol\n",
+		warn("%s: .export_symbol section references '%s', but it does not seem to be an export symbol\n",
 		      mod->name, name);
 		return;
 	}
@@ -1080,7 +1080,7 @@ static void check_export_symbol(struct module *mod, struct elf_info *elf,
 	} else if (!strcmp(data, "")) {
 		is_gpl = false;
 	} else {
-		error("%s: unknown license '%s' was specified for '%s'\n",
+		warn("%s: unknown license '%s' was specified for '%s'\n",
 		      mod->name, data, name);
 		return;
 	}
Signature · 1 line
2.33.0
#1 lore raw
Quoted 6 lines · On Sat, Jun 7, 2025 at 6:08 PM <[email protected]> wrote:

From: huyubiao <[email protected]>

Since the commit ddb5cdbafaaa ("kbuild: generate KSYMTAB entries by modpost"), modpost has become stricter in handling EXPORT_SYMBOL, making it incompatible with older versions of livepatch builds.

Is the error level too strict? In my opinion, even if there are issues with the use of EXPORT_SYMBOL, they are not necessarily fatal to program execution.

These are errors, as they should be.
Why should I loosen the preciseness for your purpose?

Quoted 45 lines
---
 scripts/mod/modpost.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/mod/modpost.c +4 -5
index fb787a5715..13f81392a4 100644
@@ -1055,21 +1055,21 @@ static void check_export_symbol(struct module *mod, struct elf_info *elf,
        label_name = sym_name(elf, label);
 
        if (!strstarts(label_name, prefix)) {
-               error("%s: .export_symbol section contains strange symbol '%s'\n",
+               warn("%s: .export_symbol section contains strange symbol '%s'\n",
                      mod->name, label_name);
                return;
        }
 
        if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL &&
            ELF_ST_BIND(sym->st_info) != STB_WEAK) {
-               error("%s: local symbol '%s' was exported\n", mod->name,
+               warn("%s: local symbol '%s' was exported\n", mod->name,
                      label_name + strlen(prefix));
                return;
        }
 
        name = sym_name(elf, sym);
        if (strcmp(label_name + strlen(prefix), name)) {
-               error("%s: .export_symbol section references '%s', but it does not seem to be an export symbol\n",
+               warn("%s: .export_symbol section references '%s', but it does not seem to be an export symbol\n",
                      mod->name, name);
                return;
        }
@@ -1080,7 +1080,7 @@ static void check_export_symbol(struct module *mod, struct elf_info *elf,
        } else if (!strcmp(data, "")) {
                is_gpl = false;
        } else {
-               error("%s: unknown license '%s' was specified for '%s'\n",
+               warn("%s: unknown license '%s' was specified for '%s'\n",
                      mod->name, data, name);
                return;
        }
--

2.33.0

Signature · 2 lines
Best Regards
Masahiro Yamada