From: Zheng Yejian zhengyejian1@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I53WZ9
--------------------------------
Signed-off-by: Zheng Yejian zhengyejian1@huawei.com Reviewed-by: Kuohai Xu xukuohai@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- arch/arm/kernel/livepatch.c | 4 +++- arch/arm64/kernel/livepatch.c | 4 +++- arch/powerpc/kernel/livepatch_32.c | 4 +++- arch/powerpc/kernel/livepatch_64.c | 4 +++- arch/x86/kernel/livepatch.c | 24 ++++++++++++++---------- 5 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/arch/arm/kernel/livepatch.c b/arch/arm/kernel/livepatch.c index d5223046cc66..da88113d14e9 100644 --- a/arch/arm/kernel/livepatch.c +++ b/arch/arm/kernel/livepatch.c @@ -283,8 +283,10 @@ int klp_check_calltrace(struct klp_patch *patch, int enable) };
ret = klp_check_activeness_func(patch, enable, &check_funcs); - if (ret) + if (ret) { + pr_err("collect active functions failed, ret=%d\n", ret); goto out; + } args.check_funcs = check_funcs;
for_each_process_thread(g, t) { diff --git a/arch/arm64/kernel/livepatch.c b/arch/arm64/kernel/livepatch.c index ad4c8337f7f3..e83e4ce94887 100644 --- a/arch/arm64/kernel/livepatch.c +++ b/arch/arm64/kernel/livepatch.c @@ -276,8 +276,10 @@ int klp_check_calltrace(struct klp_patch *patch, int enable) };
ret = klp_check_activeness_func(patch, enable, &check_funcs); - if (ret) + if (ret) { + pr_err("collect active functions failed, ret=%d\n", ret); goto out; + } args.check_funcs = check_funcs;
for_each_process_thread(g, t) { diff --git a/arch/powerpc/kernel/livepatch_32.c b/arch/powerpc/kernel/livepatch_32.c index 8fe9ebe43b25..a3cf41af073e 100644 --- a/arch/powerpc/kernel/livepatch_32.c +++ b/arch/powerpc/kernel/livepatch_32.c @@ -311,8 +311,10 @@ int klp_check_calltrace(struct klp_patch *patch, int enable) };
ret = klp_check_activeness_func(patch, enable, &check_funcs); - if (ret) + if (ret) { + pr_err("collect active functions failed, ret=%d\n", ret); goto out; + } args.check_funcs = check_funcs;
for_each_process_thread(g, t) { diff --git a/arch/powerpc/kernel/livepatch_64.c b/arch/powerpc/kernel/livepatch_64.c index 90d3e37a0bfe..0098ad48f918 100644 --- a/arch/powerpc/kernel/livepatch_64.c +++ b/arch/powerpc/kernel/livepatch_64.c @@ -359,8 +359,10 @@ int klp_check_calltrace(struct klp_patch *patch, int enable) struct walk_stackframe_args args;
ret = klp_check_activeness_func(patch, enable, &check_funcs); - if (ret) + if (ret) { + pr_err("collect active functions failed, ret=%d\n", ret); goto out; + } args.check_funcs = check_funcs; args.ret = 0;
diff --git a/arch/x86/kernel/livepatch.c b/arch/x86/kernel/livepatch.c index 385b8428da91..fe34183826d3 100644 --- a/arch/x86/kernel/livepatch.c +++ b/arch/x86/kernel/livepatch.c @@ -321,38 +321,42 @@ int klp_check_calltrace(struct klp_patch *patch, int enable) #endif
ret = klp_check_activeness_func(patch, enable, &check_funcs); - if (ret) + if (ret) { + pr_err("collect active functions failed, ret=%d\n", ret); goto out; + } for_each_process_thread(g, t) { if (!strncmp(t->comm, "migration/", 10)) continue;
#ifdef CONFIG_ARCH_STACKWALK ret = stack_trace_save_tsk_reliable(t, trace_entries, MAX_STACK_ENTRIES); - if (ret < 0) + if (ret < 0) { + pr_err("%s:%d has an unreliable stack, ret=%d\n", + t->comm, t->pid, ret); goto out; + } trace_len = ret; - ret = 0; + ret = klp_check_stack(trace_entries, trace_len, check_funcs); #else trace.skip = 0; trace.nr_entries = 0; trace.max_entries = MAX_STACK_ENTRIES; trace.entries = trace_entries; ret = save_stack_trace_tsk_reliable(t, &trace); -#endif WARN_ON_ONCE(ret == -ENOSYS); if (ret) { - pr_info("%s: %s:%d has an unreliable stack\n", - __func__, t->comm, t->pid); + pr_err("%s: %s:%d has an unreliable stack, ret=%d\n", + __func__, t->comm, t->pid, ret); goto out; } -#ifdef CONFIG_ARCH_STACKWALK - ret = klp_check_stack(trace_entries, trace_len, check_funcs); -#else ret = klp_check_stack(&trace, 0, check_funcs); #endif - if (ret) + if (ret) { + pr_err("%s:%d check stack failed, ret=%d\n", + t->comm, t->pid, ret); goto out; + } }
out: