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)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 15 Oct 2021 09:25:14 +0000 (11:25 +0200)
commitbc9bbb81730ea667c31c5b284f95ee312bab466f
treef9f4a5d7a04d22d2b7bb4d0fa4d9d0301b436497
parent4e046156792c26bef8a4e30be711777fc8578257
x86: Fix get_wchan() to support the ORC unwinder

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
arch/x86/kernel/process.c