From: Greg Kroah-Hartman Date: Thu, 18 Nov 2021 12:15:35 +0000 (+0100) Subject: Revert "x86: Fix __get_wchan() for !STACKTRACE" X-Git-Tag: v5.14.20~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b51c1a592faaf114b33f56f25aec757d21a826e0;p=thirdparty%2Fkernel%2Fstable.git Revert "x86: Fix __get_wchan() for !STACKTRACE" This reverts commit e1ff40b6194f09c1dd0f45b94fdf30c0374b5823 which is commit 5d1ceb3969b6b2e47e2df6d17790a7c5a20fcbb4 upstream. It has been reported to be causing problems, and is being reworked upstream and has been dropped from the current 5.15.y stable queue until it gets resolved. Reported-by: Chris Rankin Reported-by: Thorsten Leemhuis Link: https://lore.kernel.org/r/ed000478-2a60-0066-c337-a04bffc112b1@leemhuis.info Cc: Stephen Rothwell Cc: Peter Zijlstra (Intel) Cc: Kees Cook Cc: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 2fe1810e922a9..266962547b58c 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -43,7 +43,6 @@ #include #include #include -#include #include "process.h" @@ -946,20 +945,10 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) */ unsigned long __get_wchan(struct task_struct *p) { - struct unwind_state state; - unsigned long addr = 0; + unsigned long entry = 0; - for (unwind_start(&state, p, NULL, NULL); !unwind_done(&state); - unwind_next_frame(&state)) { - addr = unwind_get_return_address(&state); - if (!addr) - break; - if (in_sched_functions(addr)) - continue; - break; - } - - return addr; + stack_trace_save_tsk(p, &entry, 1, 0); + return entry; } long do_arch_prctl_common(struct task_struct *task, int option,