From: Zhao Xuehui zhaoxuehui1@huawei.com
hulk inclusion category: bugfix bugzilla: 50773 CVE: NA
-------------------------------------------------
An error occurred while activating the livepatch. the error message: 1. "livepatch: klp_check_stack: migration/0:11 has an unreliable stack" 2. "insmod: can't insert 'xxxx.ko': invalid paramete"
The stack of all threads will be checked when activing the livepatch in function klp_check_calltrace(). However, there is no way to get the stack of migration thread during this process. Before the error handling changed in __unwind_start(), the stack state of migration thread is not changed and the function save_stack_trace_tsk_reliable() will return normally. After the error handling in __unwind_start() is fixed, the stack state of migration thread is changged to 'untrusted'. It means that the stack check of migration thread will fail, which causing the failure of activating livepatch. So we skip the thread stack check of the migration thread to ensure the success activation of livepatch.
Fixes: 7ce42682f925 ("x86/unwind/orc: Fix error handling in __unwind_start()")
Signed-off-by: Zhao Xuehui zhaoxuehui1@huawei.com Reviewed-by: Dong Kai dongkai11@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- arch/x86/kernel/livepatch.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/arch/x86/kernel/livepatch.c b/arch/x86/kernel/livepatch.c index c853ac57492dc..e927624d5016f 100644 --- a/arch/x86/kernel/livepatch.c +++ b/arch/x86/kernel/livepatch.c @@ -240,6 +240,9 @@ int klp_check_calltrace(struct klp_patch *patch, int enable) int ret = 0;
for_each_process_thread(g, t) { + /* the stack of migration thread cannot be obtained, skip it here*/ + if (strncmp(t->comm, "migration/", 10) == 0) + continue; ret = klp_check_stack(t, patch, enable); if (ret) goto out;