From ba5f334ea2608dadb260ec0f9e1dc94e787a4bea Mon Sep 17 00:00:00 2001 From: Cheng Jian Date: Mon, 28 Jan 2019 10:09:12 +0800 Subject: [PATCH] livepatch/arm64: support function force patched/unpatched euler inclusion category: feature Bugzilla: 5507 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: Cheng Jian Reviewed-by: Li Bin Signed-off-by: Yang Yingliang --- arch/arm64/kernel/livepatch.c | 2 ++ include/linux/livepatch.h | 1 + 2 files changed, 3 insertions(+) diff --git a/arch/arm64/kernel/livepatch.c b/arch/arm64/kernel/livepatch.c index a21c3f79d3cc..71b99400c388 100644 --- a/arch/arm64/kernel/livepatch.c +++ b/arch/arm64/kernel/livepatch.c @@ -77,6 +77,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; func_addr = func->old_addr; func_size = func->old_size; } else { diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h index 70b081a691e4..2863ab118321 100644 --- a/include/linux/livepatch.h +++ b/include/linux/livepatch.h @@ -75,6 +75,7 @@ struct klp_func { * in kallsyms for the given object is used. */ unsigned long old_sympos; + int force; /* internal */ unsigned long old_addr; -- GitLab