]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
x86: Fix get_wchan() to support the ORC unwinder
authorQi Zheng <zhengqi.arch@bytedance.com>
Wed, 29 Sep 2021 22:02:17 +0000 (15:02 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Nov 2021 10:04:07 +0000 (11:04 +0100)
commitf270511247a5b6257b84db17883e0b1189bf5e16
tree9f8eff6055edae2ce8b6b6b21ebd331ab991f4b8
parent5652137ef6536d3f5c154e38682bebafe2454048
x86: Fix get_wchan() to support the ORC unwinder

[ Upstream commit bc9bbb81730ea667c31c5b284f95ee312bab466f ]

Currently, the kernel CONFIG_UNWINDER_ORC option is enabled by default
on x86, but the implementation of get_wchan() is still based on the frame
pointer unwinder, so the /proc/<pid>/wchan usually returned 0 regardless
of whether the task <pid> is running.

Reimplement get_wchan() by calling stack_trace_save_tsk(), which is
adapted to the ORC and frame pointer unwinders.

Fixes: ee9f8fce9964 ("x86/unwind: Add the ORC unwinder")
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20211008111626.271115116@infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kernel/process.c