On Tue 2024-08-27 14:30:48, Lukas Hruska wrote:
> From: Josh Poimboeuf <[email protected]>
>
> Call klp-convert for the livepatch modules after the final linking.
>
> Also update the modpost tool so that it does not warn about unresolved
> symbols matching the expected format which will be then resolved by
> klp-convert.
>
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -1676,10 +1680,18 @@ static void check_exports(struct module *mod)
> const char *basename;
> exp = find_symbol(s->name);
> if (!exp) {
> - if (!s->weak && nr_unresolved++ <
> MAX_UNRESOLVED_REPORTS)
> + if (!s->weak && nr_unresolved++ <
> MAX_UNRESOLVED_REPORTS) {
> + /*
> + * In case of livepatch module we allow
> + * unresolved symbol with a specific format
> + */
> + if (mod->is_livepatch &&
> + strncmp(s->name, KLP_SYM_RELA,
> strlen(KLP_SYM_RELA)) == 0)
> + break;
Just for record. There must be "continue" instead of "break".
Otherwise, the function does not check the remaining symbols.
It won't copy CRCs of exported symbols. Finally, depmod would
complain about incompatible versions of symbols.
> modpost_log(warn_unresolved ? LOG_WARN :
> LOG_ERROR,
> "\"%s\" [%s.ko] undefined!\n",
> s->name, mod->name);
> + }
> continue;
> }
> if (exp->module == mod) {
Best Regards,
Petr
PS: I am not sure if this patchset would ever reach upstream.
But we found this bug when using the tool...