Re: [PATCH 5.15 64/76] proc: Use task_is_running() for wchan in /proc/$pid/stat

From: Kees Cook
Date: Wed Mar 13 2024 - 23:04:55 EST


On Wed, Mar 13, 2024 at 12:42:11PM -0400, Sasha Levin wrote:
> From: Kees Cook <keescook@xxxxxxxxxxxx>
>
> [ Upstream commit 4e046156792c26bef8a4e30be711777fc8578257 ]
>
> The implementations of get_wchan() can be expensive. The only information
> imparted here is whether or not a process is currently blocked in the
> scheduler (and even this doesn't need to be exact). Avoid doing the
> heavy lifting of stack walking and just report that information by using
> task_is_running().
>
> Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> Link: https://lkml.kernel.org/r/20211008111626.211281780@xxxxxxxxxxxxx
> Stable-dep-of: 60f92acb60a9 ("fs/proc: do_task_stat: move thread_group_cputime_adjusted() outside of lock_task_sighand()")
> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

Looks fine to me. Can you double-check that commit
54354c6a9f7f ("Revert "proc/wchan: use printk format instead of lookup_symbol_name()"")
is already backported too?

--
Kees Cook