Re: [PATCH] selftests/livepatch: Test rejection of aliased symbols in one object
From: Petr Mladek
Date: Tue Sep 08 2026 - 03:18:29 EST
On Sat 2026-09-05 23:55:07, Harry Hsu wrote:
> klp_init_object_loaded() now rejects an object whose klp_funcs resolve to
> the same address, because aliased symbols would push two klp_funcs of one
> livepatch onto a single ops->func_stack and leave the redirection
> ambiguous.
>
> Add a target module providing test_klp_alias_show() together with its
> __alias() sibling, and a livepatch naming both of them. Two test cases
> cover both callers of klp_init_object_loaded(): the klp_enable_patch()
> path, where the target module is loaded before the livepatch, and the
> klp_module_coming() path, where the livepatch is loaded first and the
> module loader has to refuse the target module.
>
> Suggested-by: Song Liu <song@xxxxxxxxxx>
> Signed-off-by: Harry Hsu <x90613@xxxxxxxxx>
Looks good to me and seems to work:
Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>
Tested-by: Petr Mladek <pmladek@xxxxxxxx>
> This is the selftest I promised in the v2 thread [1].
>
> It applies on top of patch 1/3 of the series [2] and does not touch the
> rest of it. Petr, since you are going to post v4 of the whole patchset
> anyway, please feel free to fold this in as the last patch. Otherwise I
> am happy to resend it as a separate follow-up once the series lands --
> whichever is less work for you.
Yup, I am working on v4 and included this patch.
Best Regards,
Petr