On Fri, 20 Mar 2026 17:11:17 -0300, Pablo Hugen <[email protected]> wrote:
> Add a target module and livepatch pair that verify module function
> patching via a proc entry. Two test cases cover both the
> klp_enable_patch path (target loaded before livepatch) and the
> klp_module_coming path (livepatch loaded before target).

We sort of test the same in test-callbacks.sh. Just using different
means. I think I would not mind having this as well.

Petr, Joe, what do you think?

>
>
> diff --git 
> a/tools/testing/selftests/livepatch/test_modules/test_klp_mod_target.c 
> b/tools/testing/selftests/livepatch/test_modules/test_klp_mod_target.c
> new file mode 100644
> index 000000000000..9643984d2402
> --- /dev/null
> +++ b/tools/testing/selftests/livepatch/test_modules/test_klp_mod_target.c
> @@ -0,0 +1,39 @@
> [ ... skip 11 lines ... ]
> +
> +static noinline int test_klp_mod_target_show(struct seq_file *m, void *v)
> +{
> +     seq_printf(m, "%s: %s\n", THIS_MODULE->name, "original output");
> +     return 0;
> +}

A nit but is 'noinline' keyword needed here? proc_create_single() below
takes a function pointer so hopefully test_klp_mod_target_show() stays
even without it?

> +
> +static int test_klp_mod_target_init(void)
> +{
> +     pr_info("%s\n", __func__);
> +     pde = proc_create_single("test_klp_mod_target", 0, NULL,
> +                              test_klp_mod_target_show);

...here.

Otherwise it looks good to me.

-- 
Miroslav


Reply via email to