On Mon 2025-10-13 10:30:19, Song Liu wrote:
> When there is only one function of the same name, old_sympos of 0 and 1
> are logically identical. Match them in klp_find_func().
> 
> This is to avoid a corner case with different toolchain behavior.
> 
> In this specific issue, issue two versions of kpatch-build were used to

  s/issue, issue/issue/

> build livepatch for the same kernel. One assigns old_sympos == 0 for
> unique local functions, the other assigns old_sympos == 1 for unique
> local functions. Both versions work fine by themselves. (PS: This
> behavior change was introduced in a downstream version of kpatch-build.
> This change does not exist in upstream kpatch-build.)
> 
> However, during livepatch upgrade (with the replace flag set) from a
> patch built with one version of kpatch-build to the same fix built with
> the other version of kpatch-build, livepatching fails with errors like:
> 
> --- a/kernel/livepatch/core.c
> +++ b/kernel/livepatch/core.c
> @@ -88,8 +88,14 @@ static struct klp_func *klp_find_func(struct klp_object 
> *obj,
>       struct klp_func *func;
>  
>       klp_for_each_func(obj, func) {
> +             /*
> +              * Besides identical old_sympos, also condiser old_sympos

As Josh already pointed out:

   s/condiser/consider/

> +              * of 0 and 1 are identical.
> +              */
>               if ((strcmp(old_func->old_name, func->old_name) == 0) &&
> -                 (old_func->old_sympos == func->old_sympos)) {
> +                 ((old_func->old_sympos == func->old_sympos) ||
> +                  (old_func->old_sympos == 0 && func->old_sympos == 1) ||
> +                  (old_func->old_sympos == 1 && func->old_sympos == 0))) {
>                       return func;
>               }
>       }

With the two above fixes:

Reviewed-by: Petr Mladek <[email protected]>
Tested-by: Petr Mladek <[email protected]>

I have fixed both problems when committing.

And the patch has been committed into livepatching.git,
branch for-6.19/trivial.

Best Regards,
Petr

Reply via email to