Messages in this thread Patch in this message | | | From | Kees Cook <> | Subject | [PATCH v2 4/6] proc: Only report /proc/$pid/wchan when process is blocked | Date | Wed, 29 Sep 2021 15:02:16 -0700 |
| |
The current get_wchan() implementations do their best to avoid problems when walking a stack given a process in an unknown state, but this is fragile and unnecessary. It's only useful to report wchan if a process is actually blocked, so use the new sched_task_get_wchan() instead.
Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Christian Brauner <christian.brauner@ubuntu.com> Cc: Jann Horn <jannh@google.com> Cc: Michal Hocko <mhocko@suse.com> Cc: Helge Deller <deller@gmx.de> Cc: linux-fsdevel@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> --- fs/proc/base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/proc/base.c b/fs/proc/base.c index 1f394095eb88..7853592778b2 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -392,7 +392,8 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns, if (!ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)) goto print0; - wchan = get_wchan(task); + wchan = sched_task_get_wchan(task); + /* Must only report symbolized addresses and never raw pointers. */ if (wchan && !lookup_symbol_name(wchan, symname)) { seq_puts(m, symname); return 0; -- 2.30.2
| |