Commit 648d9735 authored by Zheng Yejian's avatar Zheng Yejian
Browse files

livepatch/core: Disable support for replacing

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8ORHJ



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

Replacing is an optimization for livepatching based on ftrace, the
wo_ftrace solution do not support it.

Signed-off-by: default avatarZheng Yejian <zhengyejian1@huawei.com>
parent e71480af
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1155,6 +1155,9 @@ static void klp_init_func_early(struct klp_object *obj,
	kobject_init(&func->kobj, &klp_ktype_func);
	list_add_tail(&func->node, &obj->func_list);
	func->func_node = NULL;
#ifdef CONFIG_LIVEPATCH_STOP_MACHINE_CONSISTENCY
	func->nop = false;
#endif
}

static void klp_init_object_early(struct klp_patch *patch,
@@ -1165,6 +1168,7 @@ static void klp_init_object_early(struct klp_patch *patch,
	list_add_tail(&obj->node, &patch->obj_list);
#ifdef CONFIG_LIVEPATCH_STOP_MACHINE_CONSISTENCY
	obj->mod = NULL;
	obj->dynamic = false;
#endif
}

@@ -1199,6 +1203,12 @@ static int klp_init_patch(struct klp_patch *patch)
	if (ret)
		return ret;

#ifdef CONFIG_LIVEPATCH_STOP_MACHINE_CONSISTENCY
	if (patch->replace) {
		pr_err("Replacing is not supported\n");
		return -EINVAL;
	}
#endif
	if (patch->replace) {
		ret = klp_add_nops(patch);
		if (ret)