sched: Add wrapper for get_wchan() to keep task blocked
Having a stable wchan means the process must be blocked and for it to stay that way while performing stack unwinding. Suggested-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> [arm] Tested-by: Mark Rutland <mark.rutland@arm.com> [arm64] Link: https://lkml.kernel.org/r/20211008111626.332092234@infradead.org
This commit is contained in:
committed by
Peter Zijlstra
parent
bc9bbb8173
commit
42a20f86dc
@@ -128,16 +128,14 @@ static bool save_wchan(void *arg, unsigned long pc)
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned long get_wchan(struct task_struct *task)
|
||||
unsigned long __get_wchan(struct task_struct *task)
|
||||
{
|
||||
unsigned long pc = 0;
|
||||
|
||||
if (likely(task && task != current && !task_is_running(task))) {
|
||||
if (!try_get_task_stack(task))
|
||||
return 0;
|
||||
walk_stackframe(task, NULL, save_wchan, &pc);
|
||||
put_task_stack(task);
|
||||
}
|
||||
if (!try_get_task_stack(task))
|
||||
return 0;
|
||||
walk_stackframe(task, NULL, save_wchan, &pc);
|
||||
put_task_stack(task);
|
||||
return pc;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user