Commit 673d37a2 authored by Cheng Jian's avatar Cheng Jian Committed by Zheng Zengkai
Browse files

livepatch/core: Support function force patched/unpatched



euler inclusion
category: feature
bugzilla: 51921
CVE: N/A

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

Some functions in the kernel are always on the stack of some
thread in the system. Attempts to patch these function will
currently always fail the activeness safety check.

However, through human inspection, it can be determined that,
for a particular function, consistency is maintained even if
the old and new versions of the function run concurrently.

commit 2e93c5e1e3dc ("support forced patching") in kpatch-build
introduces a KPATCH_FORCE_UNSAFE() macro to define patched
functions that such be exempted from the activeness safety
check. now kernel implement this feature.

Signed-off-by: default avatarCheng Jian <cj.chengjian@huawei.com>
Reviewed-by: default avatarLi Bin <huawei.libin@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarWang ShaoBo <bobo.shaobowang@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 d97c0592
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -99,6 +99,8 @@ static int klp_check_activeness_func(struct stackframe *frame, void *data)
	for (obj = patch->objs; obj->funcs; obj++) {
		for (func = obj->funcs; func->old_name; func++) {
			if (args->enable) {
				if (func->force)
					continue;
				/*
				 * When enable, checking the currently
				 * active functions.
+2 −0
Original line number Diff line number Diff line
@@ -104,6 +104,8 @@ static bool klp_check_activeness_func(void *data, unsigned long pc)
	for (obj = patch->objs; obj->funcs; obj++) {
		for (func = obj->funcs; func->old_name; func++) {
			if (args->enable) {
				if (func->force)
					continue;
				/*
				 * When enable, checking the currently
				 * active functions.
+2 −0
Original line number Diff line number Diff line
@@ -93,6 +93,8 @@ static int klp_check_activeness_func(struct stackframe *frame, void *data)
	for (obj = patch->objs; obj->funcs; obj++) {
		for (func = obj->funcs; func->old_name; func++) {
			if (args->enable) {
				if (func->force)
					continue;
				/*
				 * When enable, checking the currently
				 * active functions.
+2 −0
Original line number Diff line number Diff line
@@ -132,6 +132,8 @@ static int klp_check_activeness_func(struct stackframe *frame, void *data)

			/* Check func address in stack */
			if (args->enable) {
				if (func->force)
					continue;
				/*
				 * When enable, checking the currently
				 * active functions.
+2 −0
Original line number Diff line number Diff line
@@ -90,6 +90,8 @@ static int klp_check_stack_func(struct klp_func *func,
#endif

		if (enable) {
			if (func->force)
				continue;
			/*
			 * When enable, checking the currently active
			 * functions.
Loading