Commit 000197c7 authored by Cheng Jian's avatar Cheng Jian Committed by Zheng Zengkai
Browse files

livepatch/ppc64: Sample testcase fix ppc64



hulk inclusion
category: feature
bugzilla: 51924
CVE: NA

---------------------------

The previous sample use case did not consider the APC and function
descriptors of PPC64

Signed-off-by: default avatarCheng Jian <cj.chengjian@huawei.com>
Reviewed-By: default avatarXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: default avataryangerkun <yangerkun@huawei.com>

Signed-off-by: default avatarDong Kai <dongkai11@huawei.com>

Signed-off-by: default avatarYe Weihua <yeweihua4@huawei.com>
Reviewed-by: default avatarYang Jihong <yangjihong1@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 26c48dbf
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -10,6 +10,9 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/livepatch.h>
#ifdef CONFIG_PPC64
#include <asm/code-patching.h>
#endif

/*
 * This (dumb) live patch overrides the function that prints the
@@ -38,7 +41,11 @@ static int livepatch_cmdline_proc_show(struct seq_file *m, void *v)

static struct klp_func funcs[] = {
	{
#ifdef CONFIG_PPC64
		.old_name = ".cmdline_proc_show",
#else
		.old_name = "cmdline_proc_show",
#endif
		.new_func = livepatch_cmdline_proc_show,
	}, { }
};
@@ -57,6 +64,10 @@ static struct klp_patch patch = {

static int livepatch_init(void)
{
#ifdef CONFIG_PPC64
	patch.objs[0].funcs[0].new_func =
		(void *)ppc_function_entry((void *)livepatch_cmdline_proc_show);
#endif
	return klp_enable_patch(&patch);
}