Re: [PATCH v7 00/10] livepatch: klp-convert tool

Joe Lawrence
2023-03-31T16:04:47Z

On 3/30/23 13:04, Alexey Dobriyan wrote:
> This patchset somehow breaks the build of the simplest livepatch module:
>
> make -f linux/linux-1/scripts/Makefile.modfinal
> make[1]: *** No rule to make target 'linux/module-klp/main.tmp.ko', needed by 'linux/module-klp/main.ko'. Stop.
>

Thanks for testing.

Presumably this is an out-of-tree livepatch module? If so, that is
still on the TODO list. If not, that is weird as the patchset itself
includes updates to samples/ and lib/ livepatches that build and load fine.

--
Joe

> $ cat Kbuild
> obj-m := main.o
>
> $ cat main.c
> #include <linux/module.h>
> #include <linux/kernel.h>
> #include <linux/livepatch.h>
> #include <linux/seq_file.h>
>
> static int livepatch_cmdline_proc_show(struct seq_file *m, void *data)
> {
> seq_puts(m, "REDACTED 001\n");
> return 0;
> }
>
> static struct klp_func funcs[] = {
> {
> .old_name = "cmdline_proc_show",
> .new_func = livepatch_cmdline_proc_show,
> },
> {}
> };
>
> static struct klp_object objs[] = {
> {
> .funcs = funcs,
> },
> {}
> };
>
> static struct klp_patch g_patch = {
> .mod = THIS_MODULE,
> .objs = objs,
> };
>
> static int livepatch_init(void)
> {
> return klp_enable_patch(&g_patch);
> }
>
> static void livepatch_exit(void)
> {
> }
> module_init(livepatch_init);
> module_exit(livepatch_exit);
> MODULE_LICENSE("GPL");
> MODULE_INFO(livepatch, "Y");
>