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

Alexey Dobriyan
2023-03-30T17:04:37Z

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.

$ 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");